Bug Collector
A bug collector collects bugs every day for seven days. Write a program that keeps a running total of the number of bugs collected during the seven 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.
COMPLETE PROGRAM CODE:
# initialize a variable to store the total number of bugs
total_bugs = 0
# create a for loop that iterates 7 times
for day in range(7):
# prompt the user to enter the number of bugs collected for each day
bugs = int(input("Enter the number of bugs collected for day " + str(day + 1) + ": "))
# add the number of bugs collected to the total
total_bugs += bugs
# display the total number of bugs collected
print("The total number of bugs collected is", total_bugs)
OUTPUT 1:
Enter the number of bugs collected for day 1: 33
Enter the number of bugs collected for day 2: 2
Enter the number of bugs collected for day 3: 4
Enter the number of bugs collected for day 4: 6
Enter the number of bugs collected for day 5: 55
Enter the number of bugs collected for day 6: 2
Enter the number of bugs collected for day 7: 69
The total number of bugs collected is 171
OUTPUT 2:
Enter the number of bugs collected for day 1: 10
Enter the number of bugs collected for day 2: 20
Enter the number of bugs collected for day 3: 30
Enter the number of bugs collected for day 4: 50
Enter the number of bugs collected for day 5: 35
Enter the number of bugs collected for day 6: 25
Enter the number of bugs collected for day 7: 10
The total number of bugs collected is 180