Menu

[solved]-Unit 5 1 Programming Assignment Looping Due Saturday 11 59pm Points 20 Submitting File Upl Q39030279

Unit 5-1: Programming Assignment - looping Due Saturday by 11:59pm Points 20 Submitting a file upload Two pieces of code usin

Unit 5-1: Programming Assignment – looping Due Saturday by 11:59pm Points 20 Submitting a file upload Two pieces of code using while loops: # Pat # CSP 017 # Loops # Pat # CSP 017 # Loops myInput = input(‘Enter input’) while myInput != ‘stop’: count = int(myInput) myInput = input(‘Enter input’) while True: myInput = input(‘Enter input’) if myInput == ‘stop’ break count = int(my Input) print(‘The total is’, count) print(‘The total is’, count) BOTH pieces of code do the same thing – the one on the left uses a specific condition in the while, the code on the right uses a Boolean ‘True’, in addition to a ‘break’ statement. The assignment is: A bug collector collects bugs every day. Write a program that keeps a running total of the number of bugs collected. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected. As always do not simply output a number – make the output statement appropriate to what you are saying. The loop is finished when the user inputs ‘done! Show transcribed image text Unit 5-1: Programming Assignment – looping Due Saturday by 11:59pm Points 20 Submitting a file upload Two pieces of code using while loops: # Pat # CSP 017 # Loops # Pat # CSP 017 # Loops myInput = input(‘Enter input’) while myInput != ‘stop’: count = int(myInput) myInput = input(‘Enter input’) while True: myInput = input(‘Enter input’) if myInput == ‘stop’ break count = int(my Input) print(‘The total is’, count) print(‘The total is’, count) BOTH pieces of code do the same thing – the one on the left uses a specific condition in the while, the code on the right uses a Boolean ‘True’, in addition to a ‘break’ statement. The assignment is: A bug collector collects bugs every day. Write a program that keeps a running total of the number of bugs collected. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected. As always do not simply output a number – make the output statement appropriate to what you are saying. The loop is finished when the user inputs ‘done!

Expert Answer


Answer to Unit 5-1: Programming Assignment – looping Due Saturday by 11:59pm Points 20 Submitting a file upload Two pieces of code… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *