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
likoan [24]
3 years ago
15

What does the following loop do? val = 0 total = 0 while (val < 10): val = val + 1 total = total + val print(total)

Computers and Technology
1 answer:
labwork [276]3 years ago
4 0

Program in Python

val = 0

total = 0

while (val < 10):

   val = val + 1

   total = total + val

print(total)

Answer:

Prints the sum of the numbers from 1 to 10.

Explanation:

Given

The above lines of code

Required

What does the loop do?

To know what the loop does, we need to analyze the program line by line

The next two lines initialize val and total to 0 respectively

<em>val = 0 </em>

<em>total = 0 </em>

The following iteration is repeated while val is less than 10

while (val < 10):

This increases val by 1

   val = val + 1

This adds val to total

   total = total + val

This prints the value of total

print(total)

Note that the loop will be repeated 10 times and in each loop, val is incremented by 1.

The values of val is 1 to 10.

The summation of these value is then saved in total and printed afterwards.

<em>Hence, the loop adds numbers from 1 to 10</em>

You might be interested in
Which of the following ""invisible"" marks represents an inserted tab?
Pachacha [2.7K]

Answer:

Easy peasy, if you open Microsoft word and you click up at the top and you click the symbol as shown in A, then you click on inserted tab it will show up as B which is  → symbol

So the answer is B  →.

4 0
3 years ago
Who played a leading role in perfecting movable type for printing?
vaieri [72.5K]
Johannes Gutenberg, although there are various examples of movable type from China (and Korea, to a lesser extent).
6 0
3 years ago
Why we need to interpret the drawing and plans
scoray [572]

Technical drawing is essential for communicating ideas in industry and engineering.

5 0
2 years ago
Does any body like animal jam
cricket20 [7]

Answer:

Never used it so I do not know.

Explanation:

To be honest i thought you meant like animal jelly at first

7 0
3 years ago
Read 2 more answers
A production house needs an operating system that captures, saves, and generates information within a specific time. Which type
bearhunter [10]
Windows and linux are best in my opinion! Linux is not used by many people but a lot of apps can't be used for linux so best is to use windows. But Mac is not bad too. Hope I helped and have a nice day!
4 0
3 years ago
Other questions:
  • Ted wants to follow the StartSafe philosophy when working around electricity. Which of the following steps would be consistent w
    15·2 answers
  • George and Miguel want to know more about their local and online competitors and about the retail industry. What is the best way
    9·1 answer
  • The Cisco IOS automatically modifies the dead interval when the _____ interval is changed. (Points : 2) hello
    13·1 answer
  • Why do agriculture and natural resource systems vary from state to state?
    8·1 answer
  • To what would you compare the transport layer?
    12·1 answer
  • What does not stand for​
    15·2 answers
  • Each contestant auditioned her singing voice for the pageant. Participle: Word it Modifies:​
    14·1 answer
  • Helpppppppppppppppppppppppppppppppp
    13·2 answers
  • A friend wants to design an app but has never done so before and isn't sure how to begin. What would you suggest they do first?
    7·1 answer
  • 5 differences between a regular mouse and a gaming mouse​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!