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
MatroZZZ [7]
3 years ago
14

The difference between a for loop and a while loop is that a for loop is a loop that happens for a certain number of times. A wh

ile loop happens until a certain condition is met. How do you know when to use each one? Give specific examples in your answer.
Computers and Technology
1 answer:
Shalnov [3]3 years ago
4 0

For loop, if you have to fill water in a bucket three times, It will fill water in a bucket three times. While loop, If you have to take water from the well multiple times but stop when the water is empty in the well.

Explanation:

  • For loop is used mostly static way of programming.
  • While loop is used for dynamic approach of programming.
  • Static approach has fix number of times the task is done.
  • Dynamic approach is conditional attempt to complete the entire task.
  • For loop uses discrete which means it uses the count approach.
  • While loop is basis on characteristic, It works mostly with alphabet.
  • Functions play major role in while loop to take a dynamic approach.
You might be interested in
Assume that a file containing a series of integers is named numbers.txt. Write a program that calculates the average of all the
Anna [14]

Answer:

Program in Python:

file = open("numbers.txt", "r")

count = 0

isum = 0

content = file.readlines()

for nums in content:

    num = nums.rstrip('\n').split(" ")

         for i in num:

              isum= isum + int(i)

              count = count + 1

print("Average: "+str(isum/count))

Explanation:

This line opens the file named numbers.txt

file = open("numbers.txt", "r")

This line initializes num to 0

count = 0

This line initializes sum to 0

isum = 0

This line reads the content of the opened file file

content = file.readlines()

This iterates through the content of the file

for nums in content:

This removes trailing new lines and blank spaces from each number

    num = nums.rstrip('\n').split(" ")

This also iterates through the content of the file

         for i in num:

This calculates the sum of the numbers in the file

              isum= isum + int(i)

This counts the numbers in the file

              count = count + 1

This calculates and prints the average of the numbers

print("Average: "+str(isum/count))

8 0
3 years ago
A _____ virus uses the language of an application that records a sequence of keystrokes and instructions in an application, such
docker41 [41]

Answer: macro virus

Explanation:

The virus that uses virus uses the language of an application which is vital in recording the sequence of the keystrokes and the instructions in an application, like spreadsheet or the word processing in order to hide virus code is the macro virus.

A macro virus is simply a computer virus which is written in same macro language that is being used for software programs. When a software application is being infected by the macro virus, it leads to a sequence of actions which automatically start when the application is being opened.

6 0
2 years ago
Which company introduce the first Minicomputer in 1960.​
madreJ [45]

Answer:

<em>t</em><em>h</em><em>e</em><em> </em><em>f</em><em>i</em><em>r</em><em>s</em><em>t</em><em> </em><em>m</em><em>i</em><em>n</em><em>i</em><em>c</em><em>o</em><em>m</em><em>p</em><em>u</em><em>t</em><em>e</em><em>r</em><em> </em><em>w</em><em>a</em><em>s</em><em> </em><em>i</em><em>n</em><em>t</em><em>r</em><em>o</em><em>d</em><em>u</em><em>c</em><em>e</em><em> </em><em>b</em><em>y</em><em> </em><em>d</em><em>i</em><em>g</em><em>i</em><em>t</em><em>a</em><em>l</em><em> </em><em>e</em><em>q</em><em>u</em><em>i</em><em>p</em><em>m</em><em>e</em><em>n</em><em>t</em><em> </em><em>c</em><em>o</em><em>r</em><em>o</em><em>p</em><em>o</em><em>r</em><em>a</em><em>t</em><em>i</em><em>o</em><em>n</em><em> </em><em>(</em><em>D</em><em>E</em><em>C</em><em>)</em><em>a</em><em>f</em><em>t</em><em>e</em><em>r</em><em> </em><em>t</em><em>h</em><em>e</em><em>s</em><em>e</em><em> </em><em>I</em><em>B</em><em>M</em><em> </em><em>c</em><em>o</em><em>r</em><em>p</em><em>o</em><em>r</em><em>a</em><em>t</em><em>i</em><em>o</em><em>n</em><em> </em><em>a</em><em>l</em><em>s</em><em>o</em><em> </em><em>m</em><em>i</em><em>n</em><em>i</em><em>c</em><em>o</em><em>m</em><em>p</em><em>u</em><em>t</em><em>e</em><em>r</em><em> </em><em>f</em><em>o</em><em>r</em><em> </em><em>e</em><em>x</em><em>a</em><em>m</em><em>p</em><em>l</em><em>e</em><em> </em><em>P</em><em>D</em><em>P</em><em>–</em><em>1</em><em>1</em>

7 0
3 years ago
Read 2 more answers
If ten men can build a card in one week, how long does it take to 50 men?
velikii [3]
Not sure, 5 weeks? I'm sorry if it's incorrect.
4 0
3 years ago
What processing software enables the user to
Dafna11 [192]

Answer:

I think its B

Explanation:

software enables users to create and edit documents.

6 0
3 years ago
Other questions:
  • Most people prefer to pay health insurance premiums rather than pay out of pocket for medical expenses because
    15·2 answers
  • A(n) _____ allows a user to choose specific files to back up, regardless of whether or not the files have been changed.
    9·1 answer
  • What is imagined risk
    12·1 answer
  • Choose the list of the best uses for word processing software.
    8·1 answer
  • What two methods can be used to access and modify an existing program that is running on an iot device in cisco packet tracer? (
    6·1 answer
  • 50PTS!! does anyone know how you turn in a section of your slides my teacher wants us to turn in only a portion of our google sl
    6·1 answer
  • The following code will create a zombie child process because the child process is terminated and the parent process is busy in
    7·1 answer
  • Debevec mentions using the technology he described to animate entire human bodies. Discuss why you think this is or is not a goo
    13·1 answer
  • Is there a way for me to play a .mp3 file from my computer using Atom?
    10·1 answer
  • Find an interesting case on the concept of intellectual property
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!