Question

A bug collector collects bugs every day for five days. Write a program that keeps a running total of the number of bugs collected during the five days. 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.

Solution

Verified
Answered 1 year ago
Answered 1 year ago
Step 1
1 of 3

Note that this program is very similar to the one that we wrote for Algorithm Workbench exercise 4 (see my answer to that question for some extra info on syntax). That only important difference is that in this program, I'll loop over a list of the days of the week instead of just the numbers 0 through 4. Note that this is unnecessary -- you could absolutely use a range()\texttt{range()} function and just not mention the day of the week when displaying the prompts. That's completely fine, as well.

Create an account to view solutions

By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Continue with GoogleContinue with Facebook

Create an account to view solutions

By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Continue with GoogleContinue with Facebook

Recommended textbook solutions

Computer Organization and Design MIPS Edition: The Hardware/Software Interface 5th Edition by David A. Patterson, John L. Hennessy

Computer Organization and Design MIPS Edition: The Hardware/Software Interface

5th EditionISBN: 9780124077263 (5 more)David A. Patterson, John L. Hennessy
220 solutions
Starting Out with Python 3rd Edition by Tony Gaddis

Starting Out with Python

3rd EditionISBN: 9780133582734 (5 more)Tony Gaddis
610 solutions
Fundamentals of Database Systems 7th Edition by Ramez Elmasri, Shamkant B. Navathe

Fundamentals of Database Systems

7th EditionISBN: 9780133970777 (1 more)Ramez Elmasri, Shamkant B. Navathe
687 solutions
Introduction to Algorithms 3rd Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

3rd EditionISBN: 9780262033848 (2 more)Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
726 solutions

Related questions