Question

In: Computer Science

A bug collector collects bugs every day for five days. Write a program that keeps a...

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.

need this in Python

Solutions

Expert Solution

Python code:

#initializing total as 0
total=0
#looping from 1 to 5
for i in range(1,6):
    #accepting number of bugs collected in each day and adding it to total
    total+=int(input("Enter the number of bugs collected in day "+str(i)+" : "))
#printing Total number of bugs collected
print("Total number of bugs collected:",total)

Screenshot:


Input and Output:


Related Solutions

A bug collector collects bugs every day for seven days. Design a program that keeps a...
A bug collector collects bugs every day for seven days. Design 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. Finally, compute and display the average number of bugs collected. You should have 2 functions defined: A main – control program flow A...
Need a java code A bug collector collects bugs every day for 7 days. Write a...
Need a java code A bug collector collects bugs every day for 7 days. Write a program that keeps a running total of the number of bugs collected during the 7 days. The program should prompt the user to enter the number of bugs collected for each day. Finally, when the program is finished, the program should display the total number of bugs collected.
You eat five days per week at the same restaurant, and every day you order a...
You eat five days per week at the same restaurant, and every day you order a sandwich and a drink. There are 26 sandwiches including 6 vegetarian options, and 15 drinks including 4 caffeine-free drinks. On Tuesdays, you like to eat healthy, so you always choose a vegetarian sandwich and a caffeine free drink on Tuesdays. The other days you can eat any sandwich and drink any drink - but you never repeat a sandwich or a drink in the...
You eat five days per week at the same restaurant, and every day you order a...
You eat five days per week at the same restaurant, and every day you order a sandwich and a drink. There are 26 sandwiches including 6 vegetarian options, and 15 drinks including 4 caffeine-free drinks. On Tuesdays, you like to eat healthy, so you always choose a vegetarian sandwich and a caffeine free drink on Tuesdays. The other days you can eat any sandwich and drink any drink - but you never repeat a sandwich or a drink in the...
You eat five days per week at the same restaurant, and every day you order a...
You eat five days per week at the same restaurant, and every day you order a sandwich and a drink. There are 20 sandwiches including 6 vegetarian options, and 14 drinks including 4 caffeine-free drinks. On Tuesdays, you like to eat healthy, so you always choose a vegetarian sandwich and a caffeine free drink on Tuesdays. The other days you can eat any sandwich and drink any drink - but you never repeat a sandwich or a drink in the...
ASSIGNMENT: Write a program to keep track of the total number of bugs collected in a...
ASSIGNMENT: Write a program to keep track of the total number of bugs collected in a 7 day period. Ask the user for the number of bugs collected on each day, and using an accumulator, keep a running total of the number of bugs collected. Display the total number of bugs collected, the count of the number of days, and the average number of bugs collected every day. Create a constant for the number of days the bugs are being...
FOR PYTHON: Write a python program for a car salesperson who works a five day week....
FOR PYTHON: Write a python program for a car salesperson who works a five day week. The program should prompt for how many cars were sold on each day and then prompt for the selling price of each car (if any) on that day. After the data for all five days have been entered, the program should report the total number of cars sold and the total sales for the period. See example output. NOTE: duplicate the currency format shown...
Write a program IN PYTHON of the JUPYTER NOOTBOOK that keeps getting a set of numbers...
Write a program IN PYTHON of the JUPYTER NOOTBOOK that keeps getting a set of numbers from user until the user enters "done". Then shows the count, total, and average of the entered numbers. This should the answer when finished Enter a number: 55 Enter a number: 90 Enter a number: 12 Enter a number: done You entered 3 numbers, total is 157, average is 52.33333
Write a program in java that does the following: Create a StudentRecord class that keeps the...
Write a program in java that does the following: Create a StudentRecord class that keeps the following information for a student: first name (String), last name (String), and balance (integer). Provide proper constructor, setter and getter methods. Read the student information (one student per line) from the input file “csc272input.txt”. The information in the file is listed below. You can use it to generate the input file yourself, or use the original input file that is available alone with this...
Write a C++ program for Euclids Algorithm that keeps track of the number of iterations (%...
Write a C++ program for Euclids Algorithm that keeps track of the number of iterations (% & loop) 1. Euclid’s Algorithm An alternative of the Euclidean algorithm for finding greatest common divisors (GCD) is repeatedly performing the modulo operation on two numbers until the remainder is 0. Here is the pseudocode for find the GCD of two positive numbers a and b using the Euclidean algorithm :while b ≠ 0 temp = b b = a mod t a =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT