anonymous
  • anonymous
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.***
MIT 6.00 Intro Computer Science (OCW)
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
schrodinger
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
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
anonymous
  • anonymous
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.
e.mccormick
  • 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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

e.mccormick
  • 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.
anonymous
  • anonymous
http://dpaste.com/1398141/
anonymous
  • anonymous
http://dpaste.com/1398149/ Sorry I did see one issue and corrected it, but it still is not doing anything
anonymous
  • anonymous
I actually figured out what I wanted to do, thank you for your input.
e.mccormick
  • e.mccormick
Good! Debugging problems is a great skill to learn.

Looking for something else?

Not the answer you are looking for? Search for more explanations.