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
What is an example of a hard skill?
Serjik [45]
3 would be self management
4 0
3 years ago
Read 2 more answers
What is microsoft certification?
BabaBlast [244]
Microsoft certification is a series of programs that provide certification of competence in Microsoft products.
6 0
3 years ago
in your own ideas what are the disadvantages of participating in a videoconference write your answer inside the circle​
ipn [44]
Some disadvantages of taking part in a video-conference are:

1) Lack of communication from social cues (social cues are what we use to see if someone is in a good or bad mood)

2) There is a high chance of unstable network connection.

3) Technical and personal issues because not everyone is comfortable speaking on a video-conference platform.

4) It causes more stress due to the lack of organization when preparing meetings (because it’s so easy to just get on a device without preparing anything beforehand).

Hope this helped!
5 0
2 years ago
What is the full form of com​
nignag [31]

The answer is:

Commercial

3 0
3 years ago
. _______ view focuses on the text and content of a document, without much information on the page layout.
Georgia [21]
Read view
It allows to hide all instrument panels
5 0
3 years ago
Other questions:
  • Consider the following code:
    13·1 answer
  • Is there such a thing as an ethical reason for unauthorized access into a computer system?
    15·1 answer
  • _____ of a global information system (GIS) concentrates on medium-range activities that move an organization toward achieving lo
    7·1 answer
  • The road is closed a head
    9·1 answer
  • What invention in the past do you think had a significant impact on our culture/ lifestyle? What do you think will be invented/
    11·1 answer
  • The ____ attribute can be used only with input boxes that store text. Group of answer choices type pattern required value
    9·1 answer
  • Adam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correc
    9·2 answers
  • Chức năng của hàm MOD(number, divisor)?
    7·1 answer
  • Which of the following tabs on the Ribbon contains the commands for adding tables, pictures and shapes into a publication? Quest
    14·1 answer
  • Examine the following output:
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!