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
Xelga [282]
2 years ago
8

Write a program that accepts three decimal numbers as input and outputs their sum​

Computers and Technology
2 answers:
Sophie [7]2 years ago
6 0

Answer:

sum = 0.0

for i in range(0,3):

   sum += float(input("Enter a decimal number to sum: "))

print ("Sum: ", sum)

*** Sample Input ***

Enter a decimal number to sum: 1.1

Enter a decimal number to sum: 2.2

Enter a decimal number to sum: 3.3

*** Sample Output ***

Sum:  6.6

Explanation:

For this problem, a method was devised in python to create the sum of three individual decimal numbers.

The first line of code, <em>sum = 0.0</em>, initializes a variable to the float type in which we will store the value of our sum.  Note, it is initialized to 0.0 to start from a value of 0 and be considered a float.

The second line of code, <em>for i in range(0,3):</em>  is the creation of a for loop control structure.  This will allow us to repeat a process 3 amount of times using the iterator i, from value 0 to 3 in this case.  Note, 0 is inclusive and 3 is exclusive in the python range.  This means the for loop will iterate with, i=0, i=1, and i=2.

The third line of code, <em>sum += float(input("Enter a decimal number to sum: "))</em>  is simply asking the user for a number, taking that input and converting it from a string into a float, and then summing the value with the previous value of sum and saving that into sum.

The fourth line of code, <em>print ("Sum: ", sum)</em> is simply displaying the final value that was calculated by adding the three user inputs together which were stored into the variable <em>sum</em>.

Cheers.

mina [271]2 years ago
4 0

Answer:

a = float(input("Enter an integer: "))

b = float(input("Enter an integer: "))

c = float(input("Enter an integer: "))

print (a + b + c)

Explanation:

Takes three numbers that user inputs and outputs their sum (of whatever numbers are given.)

You might be interested in
Which part of the name of a document indicates the program that was used to edit it?
erica [24]

The extension is the part of the name of a document which helps in showing the program that was used for the edit.

The extension is simply a three letter word or sometimes four-letter abbreviation depending on the document.

Extension helps in showing the type of file. For example, different forms of extension are "docx", "pdf", "exe", "html" etc. They are useful as one can know the application that will be used in opening such files.

Read related link on:

brainly.com/question/16280230

3 0
3 years ago
Read 2 more answers
True or false: Machine learning lets computers
bixtya [17]

Answer:

True

Explanation:

6 0
2 years ago
Describe the purpose of these mobile devices: digital cameras,portable and digital media player, e-book readers, wearable device
allsm [11]

digital cameras are supposed to take pictures, media players play music, e-book reader is reading on the go, and game devices are for entertainment

8 0
2 years ago
Does magnifier count as assistive technology
PtichkaEL [24]
The correct answer: Yes

Assistive technology<span> is an </span>umbrella term<span> that includes assistive, adaptive, and rehabilitative devices for </span>people with disabilities<span> and also includes the process used in selecting, locating, and using them. Assistive technology promotes greater independence by enabling people to perform tasks that they were formerly unable to accomplish, or had great difficulty accomplishing, by providing enhancements to, or changing methods of interacting with, the </span>technology<span> needed to accomplish such tasks.
</span>
Magnification falls in this criteria. Therefore, we can conclude that magnification is an assistive technology which can be used to help end users see small objects in in their displays.
3 0
3 years ago
Which method allows you to choose how to display the date and time?
Alja [10]

FORMAT Is the Answer Hope it helps:)

8 0
2 years ago
Other questions:
  • which of the following electromagnetic waves are not used for communication? a.gamma rays b.microwaves c.infrared waves d.radio
    5·1 answer
  • ___ Jacking is a crime that takes place when a hacker misdirects URL to a different site. The Link Itself Looks Safe, But the us
    11·1 answer
  • The superclass Calculator contains: a protected double instance variable, accumulator, that contains the current value of the ca
    5·1 answer
  • A database administrator (DBA) must have a clear understanding of the fundamental business of an organization, be proficient in
    11·1 answer
  • Meg[] elements = {new Lois(), new Stewie(), new Meg(), new Brian()}; for (int i =0; i
    15·1 answer
  • What is the long tube on a microscope called​
    15·1 answer
  • Match the definitions of different business communication to the type of document
    7·2 answers
  • Hiiiiiiiiiiiiiiiiii <br>i'm new here!!!​
    14·2 answers
  • IPv4 and IPv6 are addresses used to identify computers on the Internet. Is this whether true or not:
    5·1 answer
  • Assuming a 32bit processor If I have a double pointer defined as dPtr and I add 1 to it. How many bytes are added to the address
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!