## Aoxx 2 years ago Ok, I am trying to do a program on my own (from scratch) to try and test things I am learning through these videos. I want to be able to have multiple loops that are defined and called upon later in the program upon user input but I cant figure out how to do it or what this is even called. (function maybe?) as an example: ***Ok, so It doesnt give me enough room so I will be putting the code in a comment.***

1. Aoxx

Num_Days = 0 ##Number of days Total_Work_Value = 0 ##Assesed value of worked hours Total_Val_Count = 0 ##Total increasing value for tracking Day1_Tickets = 0 ##Value to be looked back on for day 2 goals def Agent_Hours: Calls = float(raw_input("How many calls did you take?")) Tickets = float(raw_input("How many tickets were resolved?")) Created = float(raw_input("How many tickets did you create?")) Day1 = Calls + Tickets + Created Num_Days += 1 print "Day:",Num_Days print "Your total score for today is:",Day1 Total_Val_Count += Day1 Day1_Tickets += Tickets ##Thinking this might need to change to a variable Total_Work_Value += Day1

2. Aoxx

I know that there is probably a lot of mistakes in this block so PLEASE feel free to correct me (My feelings dont get hurt easy) and of course any explanation of corrects would help tons.

3. e.mccormick

"...I want to be able to have multiple loops that are defined and called upon later in the program upon user input..." This is control of flow and it is done through loops and conditional statements. They are generally tied together through different functions. For example, this is a pretty typical format for a beginner in psudocode: ``` def function(data): do stuff with data ## Main function: data = 0 print "Enter -1 to stop entering numbers" while data > -1: data = input function(data) ``` As you learn more, this changes to something more like this: ``` def function1(): while true: data = input if data is valid type return data else send error to user def function2(data): do stuff with data ## Main function: data = 0 print "Enter -1 to stop entering numbers" while data > -1: data = function1() function2(data) ``` The difference is that in the second one you are using conditional statements and perhaps even an exception handler to validate the user input.

4. e.mccormick

As for trying your code, when I paste regular text from here is all ends up on one line, so I would have to do all sorts of reformatting to get it to work and see. By putting ``` (the one on the ~) above and below on blank lines, it makes it into a formatted block that copies right. There are also code sharing sites like http://dpaste.com and http://pastebin.com . With those you can easily do even large chunks of code.

5. Aoxx
6. Aoxx

http://dpaste.com/1398149/ Sorry I did see one issue and corrected it, but it still is not doing anything

7. Aoxx

I actually figured out what I wanted to do, thank you for your input.

8. e.mccormick

Good! Debugging problems is a great skill to learn.