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
snow_tiger [21]
3 years ago
5

Write a program that reads decimal numbers from the keyboard. The program reads at least three numbers. Find and display the sma

llest number, the second smallest number, and the third smallest number of the set. The program ends if the largest number encountered does not change for n iterations (the largest number does not change for the next n numbers since it changed). The value of n is read from the keyboard. Value n is greater or equal to 3.
Please enter the value of n: 3
Please enter a demical number: 1.1
The set of the samllest number, the second smallest
number and the third smallest number is {1.100000, I,
/}
Please enter a demical number: 1.2
The set of the samllest number, the second smallest
number and the third smallest number is {1.100000,
1.200000, /}
Please enter a demical number: 4
The set of the samllest number, the second smallest
number and the third smallest number is {1.100000,
1.200000, 4.000000}
Please enter a demical number: 2.3
The set of the samllest number, the second smallest
number and the third smallest number is {1.100000,
1.200000, 2.300000}
Please enter a demical number: 0.4
The set of the samllest number, the second smallest
number and the third smallest number is {0.400000,
1.100000, 1.200000}
Please enter a demical number: 2.2
The set of the samllest number, the second smallest
number and the third smallest number is {0.400000,
1.100000, 1.200000} Program ended with exit code: 0
Please enter the value of n: 1
Please enter a demical number: 4
The set of the samllest number, the second smallest
number and the third smallest number is {4.000000, I,
/}
Please enter a demical number: 2
The set of the samllest number, the second smallest
number and the third smallest number is {2.000000,
4.000000, /}
Program ended with exit code: 0
Computers and Technology
1 answer:
Contact [7]3 years ago
7 0

Answer:

Explanation:

The following code is written in Pyton and keeps prompting the user for new decimal values, once the user is done it loops through the array getting the highest three values and outputting them to the user.

def atleast_three():

   numbers = []

   smallest = 0

   medium = 0

   largest = 0

   while True:

       numbers.append(float(input("Please enter a decimal value: ")))

       answer = input("Add another value? Y/N").lower()

       if answer != 'y':

           break

       else:

           continue

   for x in numbers:

       if x > largest:

           largest = x

       elif (x > medium) & (x < largest):

           medium = x

       elif (x > smallest) & (x < medium):

           smallest = x

   print(str(smallest) + ", " + str(medium) + ", " + str(largest))

You might be interested in
A circuit has a resistance of 300 ohm and a current of 0.024 A. What is the voltage in the circuit?
fomenos
**Formula

If u want to calculate voltage:
Current x Resistance

so the answer is D

Current:
Voltage ÷ Resistance

Resistance:
Voltage ÷ Current
7 0
3 years ago
What is the name of the popular DBMS (database management system) that is open source and is distributed under the General Publi
Alex_Xolod [135]

Answer:

I looked it up on google and it said that one of the most popular ones is MySQL.

Explanation:

I don't know if it's right. I just looked it up on google.

6 0
3 years ago
VW discovered that its engineers had developed a software program that allowed some of its car models to run without emissions c
den301095 [7]

Answer:

d. ​Blanchard/Peale model

Explanation:

In order to conduct proper emission test, it is essential to follow the three steps proposed by Blanchard and Peale. Their proposition can be used to answer the necessary ethical questions and proffer solutions. Therefore, the company should have conducted an ethical check to resolve the ethical issue. The correct answer is option d.

4 0
3 years ago
Read 2 more answers
Which guideline should you use when downloading software from the internet?
Anton [14]
Limiting your computer's vulnerability to malware is a crucial safe browsing habit. You can protect your computer by running antivirus<span> and </span>antimalware<span> software like </span>Bitdefender<span>, </span>Norton<span>, or </span>Kaspersky<span>. These programs can block malware from being installed and can remove it if it does get onto your computer. Even if you don't see signs of malware on your computer, running regular scans can catch any malware that has escaped notice.</span>
4 0
3 years ago
Read 2 more answers
Consider a sequence of method invocations as follows: main calls m1, m1 calls m2, m2 calls m3 and then m2 calls m4, m3 calls m5.
Minchanka [31]

Answer:

M2 is the answer for the above question.

Explanation:

  • The above question states the scenario, where firstly main function calls the M1 function.
  • Then M1 function calls the function M2.
  • Then M2 function calls the function M3.
  • Then M3 function calls the function M5.
  • Then Again M2 function will resume and calls the function M4.
  • Then Again M2 function will resume because when the M4 will ends it return to the statement of the M2 function from which the M4 function has been called.
  • It is because when any function ends its execution it returns to that line of a statement from which it has been called. This is the property of programming language to call the function.
  • So when the M4 will terminate its execution then the M2 function will resume again.
4 0
4 years ago
Other questions:
  • Explain where and why metallic material or non metallic material have been used in your home​
    8·1 answer
  • Choose all of the correct answers for each of the following:
    10·1 answer
  • Which career field has grown most as a result of technological changes?
    13·1 answer
  • What is the point of brainy when other people have to answer your questions but not the cumputer
    9·1 answer
  • What types of projects require collaboration? en360
    15·1 answer
  • PLEASE HELP ASAP!!! Prompt<br> What is the Bcc address field for?
    7·1 answer
  • Name the tools in plant propagation.<br>Q<br>18.<br>16.<br>17.<br>19.<br>20.<br>please po asap​
    15·1 answer
  • In critical thinking, an argument is:
    12·2 answers
  • Which of the following terms means the computer operating system automatically detects and installs the proper driver for a new
    9·1 answer
  • What can visible light and ultraviolet light do together
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!