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
_____ laws protect intellectual property.
loris [4]
Copyright laws protect intellectual property.
6 0
3 years ago
Read 2 more answers
All computers can support multiple internal hard drives. <br><br> a. True <br><br> b. False
lara31 [8.8K]
False.  Some can, but some do not have space for them.  Please mark Brainliest!!!
5 0
4 years ago
Assume that your body mass index (BMI) program calculated a BMI of 20.6. What would be the value of category after this portion
algol [13]

Answer:

B normal is the answer

5 0
3 years ago
Read 2 more answers
2 - identifiez fill in the blanks activity 2 attempts left late due november 8th 11:59 pm instructions you will hear a series of
malfutka [58]

Economic sanctions programs are generally administered and enforced by the Office of Foreign Assets Control against nations and specialized categories of people, such as terrorists and drug traffickers.

To achieve aims in foreign policy and national security, sanctions can be either sweeping or selective, using the asset freezing and trade restrictions. Sanctions management has a long history at the Treasury Department. Gallatin, Secretary of the Treasury, oversaw the sanctions against Great Britain for harassing American seamen beginning before the War of 1812. Congress passed a statute during the Civil War that forbade trade with the Confederacy, demanded the loss of products used in such trade, and established a licensing system governed by Treasury-managed rules and regulations.

Learn more about program here-

brainly.com/question/14618533

#SPJ4

5 0
1 year ago
what happens to a local variable when a function call completes (and control returns to the calling statement)
Liono4ka [1.6K]

When a function call completes (and control returns to the calling statement) the local variable is undefined.

After the function call is finished, the local variable can be utilized outside of the function at any time. Until the function is called again, a local variable holds onto its value.

While local variables are those that are defined inside a function and have a scope that is specific to that function only, global variables are those that are defined outside of function having global scope.

Local variables are exclusive to a given function and are produced within that function. It cannot be accessed elsewhere other than the function.

Since there are no local variables, the value from the global variables will be used; however, you must ensure that the names of the local and global variables match.

If a variable is modified or created inside of a function but isn't declared a global variable, it is considered local variable.

To learn more about local variable click here:

brainly.com/question/27840441

#SPJ4

7 0
1 year ago
Other questions:
  • (Game Design) The ESRB was created by:
    8·1 answer
  • 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
  • Which of the following is NOT contained on the Slide Show toolbar?
    11·2 answers
  • Why is outfitting a workspace with video games in technology development company considered a strategic use of money
    8·2 answers
  • A field is _____. a complete entry in a database one of the categories in a database a group of twenty-seven records a cell in a
    8·1 answer
  • Write a program that prompts the user to enter a number then counts the number of odd numbers and even numbers the user enter. T
    15·1 answer
  • A group of two or more computer systems linked together via communication devices is called:.
    10·1 answer
  • 3. Find the best.
    13·1 answer
  • Is designed to access a computer or operating system without the knowledge or permission of the user.
    15·1 answer
  • The ____ statement can be used to eliminate the use of certain (flag) variables.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!