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
The three tasks within data harmonization, namely: data consolidation, data cleansing, and data formatting use techniques called
-BARSIC- [3]

The three tasks within data harmonization, namely: data consolidation, data cleansing, and data formatting use techniques called harmonization rules that implement those tasks -The statement is true

Explanation:

Data harmonization refers to the process of combining the data of varying files and formats ,name conventions and columns and transforming the same into one data set.

Data harmonization refers to the process of integrating multiple data source into a single data set.

By adopting the Data harmonization technique we can reduce the problem of redundant data and conflicting standard

The name harmonization is an analogy to the process to harmonizing discordant music.

The goal of data harmonization is to find commonalities, identify critical data that need to be retained, and then provide a common standard.

6 0
4 years ago
How is cropping different from scaling?​
Keith_Richards [23]

Answer:

Scaling changes the size of the whole image by resampling it(duplicating the pixels). in cropping you only get a part of the original image/ remove the outer area of it .

Explanation:

8 0
3 years ago
Where do you place the logical test argument in an IF function formula?
Inessa [10]

Answer:

The first argument listed after IF

Explanation:

When the two variables are listed next to each other, Excel will find and calculate the correlation between them.

8 0
3 years ago
Read 2 more answers
Which protocol that runs on cisco routers shares information between cisco devices?
just olya [345]
The CDP protocol runs on CISCO routers and shares information between CISCO devices. CDP stands for Cisco Discovery Protocol. It is a protocol on Layer 2 (Data -Link layer) of the OSI model that enables CISCO devices to share information between them. The information includes for example the <span>operating system version and IP address.</span>
6 0
3 years ago
A user input is when the user interacts with the program by typing.<br> True<br> False
Yuri [45]
The answer is true I think
6 0
3 years ago
Read 2 more answers
Other questions:
  • I am confused in Java!
    12·1 answer
  • Scratch and grinding marks on sedimentary rocks indicate which type of environment?
    6·1 answer
  • CUANTO ES DOS MAS DOS POR FAVOR URGENTE :V
    10·2 answers
  • Define a method printAll() for class PetData that prints output as follows with inputs "Fluffy", 5, and 4444. Hint: Make use of
    10·1 answer
  • The appropriate software to use for creating research papers is ________ software. Select one: A. presentation B. word processin
    15·1 answer
  • How to find the largest number in an array java?
    13·1 answer
  • Mrs. Zoo gave out the rubric for our essay. She stated that our essay should be complete by Friday of that week. I didn't have t
    13·1 answer
  • Review how to write a for loop by choosing the output of this short program.
    6·2 answers
  • What data type would you use for a decimal number?* ​
    9·1 answer
  • Which of the following is a part of a DML statement? a. CREATE b. ALTER c. DROP d. SELECT. SE_LECT
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!