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
Dispositivo de computo
katrin2010 [14]

Answer:

wouf wouf wouf

Explanation:

i don't know.

8 0
3 years ago
Based on the following quote from Leonardo Da Vinci, what would be his definition of a fine artist? “Principles for the Developm
zvonat [6]

Answer:

A fine artist is one who sees the things other don't see and make connections other don't make.

7 0
2 years ago
Read 2 more answers
Find the median and mean of the data set below: 29 17 40 12 29
quester [9]

answer:

median: 29

arrange the data in ascending order, and the median is the value in the middle. If there are an even number of values, the median would be the product of the two middle numbers. (12, 17, 29, 29, 40)

mean: 25.4

the mean of a set of numbers is the sum divided by the number of terms.

12 + 17 + 29 + 29 + 40 = 127 / 5 = 25.4

hope this helped!

6 0
2 years ago
Identify the following as True or False.
Leni [432]

Answer:

The answer to this question as follows:

1) False

2) False

3) True

Explanation:

The description of the above option as follows

  • In option 1, A single character variable must be contained in one quote mark, but it is based on the alphabet, which is a specific device, and the price of a continued character varies from one device to another, that's why it is false.
  • In option 2, This option is wrong because in assembly language the identifier value must not exceed the length than 247 characters.
  • In option 3, It is correct because in the variable declaration the first char should be a letter, _, @ or $letter. A total of 1-247 characters. The default case is insensitive.

5 0
3 years ago
Most languages allow a specialized selection structure called the ____ structure when there are several distinct possible values
aleksandr82 [10.1K]

Answer:

CASE

Explanation:

Case Structure is a mechanism that allows different executions when there are several distinct possible values for a single variable, and each value requires a different subsequent action depending on the value of the label.

Case structure is also a conditional control structure that appears in most modern programming languages and allows a selection to be made between several sets of program statements.

8 0
3 years ago
Other questions:
  • Define the method object inc_num_kids() for personinfo. inc_num_kids increments the member data num_kids. sample output for the
    11·1 answer
  • _________ are represented using diamonds linked withparticipant ETs
    6·1 answer
  • When was unicode invented?
    13·1 answer
  • Some hardware can be added to the computer without having to restart or power down the computer. After a short period of time th
    5·1 answer
  • Csc105 final graded project
    9·1 answer
  • A ________ is a self-contained program that spreads through a computer network by exploiting security holes in the computers con
    9·1 answer
  • Whic flag has a special role in debuging
    6·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·1 answer
  • What is the best stratiget to avoid paying intrest in your credit cared
    13·1 answer
  • Radio spectrum is the part of the complete range of electromagnetic waves that is used for radio communication from
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!