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
Doss [256]
3 years ago
13

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:
Westkost [7]3 years ago
8 0

Answer:

print(total) => 45

Explanation:

# smells like Python...

val = 0 #initialize incrementor named 'val' at 0.

total = 0 #initilize accumulator named 'total' at 0.

while (val < 10): #look to execute while val is less than 10.

 val = val + 1 #increment val (val++) by 1

  total = total + val #increment total by val (val+=total)

# Step: val = 0

## val => 1, total => 1

# Step: val = 1

## val => 2, total => 3

# Step: val = 2

## val => 3, total => 5

# Step: val = 3

## val => 4, total => 9

# Step: val = 4

## val => 5, total => 14

# Step: val = 5

## val => 6, total => 20

# Step: val = 6

## val => 7, total => 27

# Step: val = 8

## val => 9, total => 36

# Step: val = 9

## val => 10 (END_LOOP), total =>  45

print(total) #print variable 'total'

You might be interested in
According to the reading on the course web pages, the earliest usage of cooking began around _____ million years ago.
fenix001 [56]

Answer:

According to the reading on the course web pages, the earliest usage of clothes began around ____ million years ago. 3.4 1.5 0.8 0.5 1.7 2. According to the reading on the course web pages, lime mortar was probably discovered from annealing: Charcoal Obsidian Flint Glass 3.

Explanation:

6 0
3 years ago
In Excel, by default, text is ____ in a cell.
Elanso [62]
<span>In excel, by default, the text is Left-alligned in a cell.
Usually, the text really is in left-aligned even in word documents. 
It's up to the user's preference to change the alignment of the text or do changes in any design.</span>
8 0
4 years ago
!!!!!HELP!!!!! (30PTS)
Inessa [10]

Answer:

B. KN

C. PP Online

Explanation:

KN is A's own software for creating slideshow presentations. However, since most people using KN are coming from using MS PP, there is the option to open PPs in KN (albeit with some fonts missing).

You can also view the file from PP Online. Just create a MS account (if you don't already have one), download the email attachment and upload it to your cloud, and you should be able to view it there.

5 0
3 years ago
When using a software budget, you should feel very confident if you choose a solution that looks like it will come in exactly on
ludmilkaskok [199]

Answer:

probably false

Explanation:

because u dont want a budget to b exact u want it completely covered

3 0
3 years ago
Which of the following statements is true?
jeka57 [31]

Answer: Constructors can specify parameters but not return types.

Explanation:

public class Student {

 int roll_no;

 public Student(int a) {

   roll_no = a;

 }

public static void main(String[] args) {

   Student abs = new Student(10);

   System.out.println(abc.roll_no);

 }

}

In the above code we have illustrated the working of constructors. We have a class with the name Student. then a constructor is created of the class called as the class constructor. In the main we create an object of the class and with this object we invoke the constructor and also pass a parameter. Here in the code we are passing the roll no of the student.

So we can say that constructor is called during the runtime when the object created invokes the constructor so a constructor can have many arguments but it does not have a return type.

7 0
3 years ago
Other questions:
  • Los antivirus no son infalibles y en ocasiones pueden darnos :
    10·1 answer
  • Which document lists the planned dates for performing tasks and meeting goals identified in the project plan?
    15·1 answer
  • The memory allocated for a float value is ____ bytes.
    9·1 answer
  • Question 2Write a MIPS assembly implementation of the following C/C++ code. Assume small, unsigned integer arithmetic (no range
    10·1 answer
  • What is the term used to describe a computer system that can store literary documents, link them according to logical relationsh
    5·1 answer
  • Which statement is true about the purpose of a work in process constraint?
    15·1 answer
  • Breaking code rules is only a problem once in a while. Group of answer choices True False
    12·1 answer
  • Which statement is most likely to be true about a computer network?
    12·2 answers
  • This is a type race kindly join.
    11·1 answer
  • A processor's speed is measured in megahertz (MHz), or millions of instructions per second; and gigahertz (GHz), or billions of
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!