1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sergiy2304 [10]
3 years ago
12

A bug collector collects bugs every day for 5 days. Write a program that keeps a running total of the number of bugs collected d

uring 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.

Computers and Technology
1 answer:
Brums [2.3K]3 years ago
7 0

Answer:

Complete code with step by step comments for explanation and output results are given below.

Python Code with Explanation:

# Initialize the counter total_bugs to store the running total of bugs  

total_bugs = 0

# Define number of days

days = 5

# Use a for loop to run for "days" number of times to take input from user

for i in range(days):

# i+1 makes sure the days start from 1 rather than 0

   print('Please enter the no. of bugs collected on day',i+1)

# Ask the user to input no. of bugs collected each day

   bugs = eval(input("Bugs collected: "))

# Keep adding new number of bugs  into running total of number of bugs

   total_bugs += bugs

# Print the total number of bugs collected in 5 days

print('The total number of bugs collected in 5 days: ', total_bugs)

Output:

Please enter the no. of bugs collected on day 1

Bugs collected: 10

Please enter the no. of bugs collected on day 1

Bugs collected: 20

Please enter the no. of bugs collected on day 1

Bugs collected: 15

Please enter the no. of bugs collected on day 1

Bugs collected: 10

Please enter the no. of bugs collected on day 1

Bugs collected: 30

The total number of bugs collected in 5 days: 85

You might be interested in
What is the term for the era created by the digital revolution?<br>​
puteri [66]

Answer:

The Digital Revolution also marks the beginning of the Information Era. The Digital Revolution is sometimes also called the Third Industrial Revolution.

Explanation:

Hope this Helps.

5 0
3 years ago
It takes 2 seconds to read or write one block from/to disk and it also takes 1 second of CPU time to merge one block of records.
Alexxx [7]

Answer:

Part a: For optimal 4-way merging, initiate with one dummy run of size 0 and merge this with the 3 smallest runs. Than merge the result to the remaining 3 runs to get a merged run of length 6000 records.

Part b: The optimal 4-way  merging takes about 249 seconds.

Explanation:

The complete question is missing while searching for the question online, a similar question is found which is solved as below:

Part a

<em>For optimal 4-way merging, we need one dummy run with size 0.</em>

  1. Merge 4 runs with size 0, 500, 800, and 1000 to produce a run with a run length of 2300. The new run length is calculated as follows L_{mrg}=L_0+L_1+L_2+L_3=0+500+800+1000=2300
  2. Merge the run as made in step 1 with the remaining 3 runs bearing length 1000, 1200, 1500. The merged run length is 6000 and is calculated as follows

       L_{merged}=L_{mrg}+L_4+L_5+L_6=2300+1000+1200+1500=6000

<em>The resulting run has length 6000 records</em>.

Part b

<u><em>For step 1</em></u>

Input Output Time

Input Output Time is given as

T_{I.O}=\frac{L_{run}}{Size_{block}} \times Time_{I/O \, per\,  block}

Here

  • L_run is 2300 for step 01
  • Size_block is 100 as given
  • Time_{I/O per block} is 2 sec

So

T_{I.O}=\frac{L_{run}}{Size_{block}} \times Time_{I/O \, per\,  block}\\T_{I.O}=\frac{2300}{100} \times 2 sec\\T_{I.O}=46 sec

So the input/output time is 46 seconds for step 01.

CPU  Time

CPU Time is given as

T_{CPU}=\frac{L_{run}}{Size_{block}} \times Time_{CPU \, per\,  block}

Here

  • L_run is 2300 for step 01
  • Size_block is 100 as given
  • Time_{CPU per block} is 1 sec

So

T_{CPU}=\frac{L_{run}}{Size_{block}} \times Time_{CPU \, per\,  block}\\T_{CPU}=\frac{2300}{100} \times 1 sec\\T_{CPU}=23 sec

So the CPU  time is 23 seconds for step 01.

Total time in step 01

T_{step-01}=T_{I.O}+T_{CPU}\\T_{step-01}=46+23\\T_{step-01}=69 sec\\

Total time in step 01 is 69 seconds.

<u><em>For step 2</em></u>

Input Output Time

Input Output Time is given as

T_{I.O}=\frac{L_{run}}{Size_{block}} \times Time_{I/O \, per\,  block}

Here

  • L_run is 6000 for step 02
  • Size_block is 100 as given
  • Time_{I/O per block} is 2 sec

So

T_{I.O}=\frac{L_{run}}{Size_{block}} \times Time_{I/O \, per\,  block}\\T_{I.O}=\frac{6000}{100} \times 2 sec\\T_{I.O}=120 sec

So the input/output time is 120 seconds for step 02.

CPU  Time

CPU Time is given as

T_{CPU}=\frac{L_{run}}{Size_{block}} \times Time_{CPU \, per\,  block}

Here

  • L_run is 6000 for step 02
  • Size_block is 100 as given
  • Time_{CPU per block} is 1 sec

So

T_{CPU}=\frac{L_{run}}{Size_{block}} \times Time_{CPU \, per\,  block}\\T_{CPU}=\frac{6000}{100} \times 1 sec\\T_{CPU}=60 sec

So the CPU  time is 60 seconds for step 02.

Total time in step 02

T_{step-02}=T_{I.O}+T_{CPU}\\T_{step-02}=120+60\\T_{step-02}=180 sec\\

Total time in step 02 is 180 seconds

Merging Time (Total)

<em>Now  the total time for merging is given as </em>

T_{merge}=T_{step-01}+T_{step-02}\\T_{merge}=69+180\\T_{merge}=249 sec\\

Total time in merging is 249 seconds seconds

5 0
3 years ago
Describe the components of the Web. Your friend wants to create and publish a Web page. He tells you that he wants to learn the
iren [92.7K]

Answer:

The answer is "HTML".

Explanation:

We will suggest him to learn HTML language because It stands for HyperText Markup Language. It is a markup language that uses a build a web page and these sites are normally viewed on the web browser.

  • It is the language for development used in the World Wide Web.
  • This language includes writing, links, images, videos, and audio files.  
  • Each one of these kinds of content is tagged and described by HTML, which uses a web browser can display it correctly.
3 0
2 years ago
Name at least TWO kinds of gaming experiences that are possible with these new control devices but were not possible on original
Pie

Yes the ansewer is c bc you can look it up!


6 0
2 years ago
Which role is responsible for turning the product backlog into incremental pieces of functionality? bookmark this question
Misha Larkins [42]
The answer is the team. Teams are self-establishing which no one not even the scrum master tells the team how to turn product backlog into augmentations of stoppable functionality. Each team member put on his or her knowledge to all of the complications. The interaction that outcomes progresses the entire scrum team’s general competence and usefulness. The optimal size for a scrum team is seven people, plus or minus two. When there are fewer than five team members, there is less interface and as a result less productivity improvement. The product owner and scrum master roles are not comprised in this count. Team arrangement may variation at the end of a sprint. Every time Team membership is altered, the productivity increased from self-organization is reduced.
4 0
3 years ago
Read 2 more answers
Other questions:
  • Using a database of precomputed hashes from sequentially calculated passwords called a(n) __________, an attacker can simply loo
    14·1 answer
  • Objective:This assignment is designed to give you experience with thinking about algorithm analysis and performanceevaluation.Pr
    11·1 answer
  • What piece of software tells the operating system how to use a specific hardware device?
    14·1 answer
  • What do you call a named collection of data stored on a disk?
    15·1 answer
  • Martha wants to invite her coworkers to her birthday party. She uses the mail merge feature to compose and send the invitations.
    6·1 answer
  • Vghfthcnbvhghvngjgjvjgkb, kcnjc cnnfjdhd mc Dan Jfhjc cm. Cm n n hdjfjocnkcnd
    10·2 answers
  • Linda wants to apply for a job in a company of her choice. Which information would her potential employers likely review in her
    10·2 answers
  • 17. When an industrial electrical circuit requires a 220 VAC single phase power supply, the electric power supply circuit is nor
    7·1 answer
  • What do I do if my friend wants me to watch a video at my house?
    8·2 answers
  • CreatePolicies<br> I need help with this in java.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!