Question

Please Use Python Check the example codes of prompting the user for a list of numbers...

Please Use Python

Check the example codes of prompting the user for a list of numbers and prints out the maximum and minimum of the numbers at the end when the user enters “done”. Write the program to store the numbers the user enters in a list and use proper Python build-in functions or loops to compute the maximum and minimum numbers after the loop completes.

Example output:

Enter a number: 6 Enter a number: 2 Enter a number: 9 Enter a number: 3 Enter a number: 5 Enter a number: done Maximum: 9.0 Minimum: 2.0

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:

i = 0
l = []
while(i != 'done'):
    i = input('Enter a number: ')
    if i.isdigit():
        l.append(float(i))


print('Maximum: ', max(l))
print('Minimum: ', min(l))

Output:

Add a comment
Know the answer?
Add Answer to:
Please Use Python Check the example codes of prompting the user for a list of numbers...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (java) Write a While loop that prompts the user for only even numbers. Keep prompting the...

    (java) Write a While loop that prompts the user for only even numbers. Keep prompting the user to enter even numbers until the user enters an odd number. After the loop ends, print the sum of the numbers. Do not include that last odd number. You should not store the numbers in an array, just keep track of the sum. Make sure to use a break statement in your code. You may assume that a java.util.Scanner object named input has...

  • Build a list by asking the user to enter names until the user enters "done". #...

    Build a list by asking the user to enter names until the user enters "done". # Build a list which contains all numbers divisible by 3 between (exclusive) and 100 (exclusive) Write a Python program that builds a list consisting of positive even numbers less than 150 (exclusive) Write a Python program that builds a list of numbers between -10 (inclusive) to 10 (inclusive) without the number @ 5 Calculations using lists

  • IN PYTHON write a program that asks the user to enter 10 numbers and store them...

    IN PYTHON write a program that asks the user to enter 10 numbers and store them in the list and then find the followings: • Maximum • Minimum prime numbers in the list • even numbers in the list • odd numbers in the list.

  • Write a PYTHON program that allows the user to navigate the lines of text in a...

    Write a PYTHON program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the...

  • python language Problem Description: In this program we are going to explore a list or an...

    python language Problem Description: In this program we are going to explore a list or an array of integers using Python. Your program should read a set of integers from the user and store them in a list. Read numbers from the user until the user enters 0 to quit. Then store them in a list. Your program should them compute the sum of all the numbers in the list and output to the user. You will use lists and...

  • Q1 (2 pts) Shopping list Write a program that prompts a user for items on their...

    Q1 (2 pts) Shopping list Write a program that prompts a user for items on their shopping list and keeps prompting the user until they enter "Done" (make sure your program can stop even if the user enters "Done" with different cases, like "done"), then prints out the items in the list, line by line, and prints the total number of items on the shopping list. Output (after collecting items in the while loop) should look something like this: Apple...

  • It needs to be done in JAVA Please don't use the flag=true method. I need it...

    It needs to be done in JAVA Please don't use the flag=true method. I need it done in another way. The user should input the number of numbers they are going to enter. Your job is to find the maximum and the minimum of these numbers. The output of the program if the user does not enter a negative number and all iterations successfully terminate, will be the maximum number, the minimum number and their difference(max-min). If the user inputs...

  • 1) Translate the following equation into a Python assignment statement 2) Write Python code that prints...

    1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...

  • hi, please use spyder formatting or python 3 accessible Apps M Gmail Maps YouTube Python 3...

    hi, please use spyder formatting or python 3 accessible Apps M Gmail Maps YouTube Python 3 1h 51m left 1. Multiplying with a Sentinel and Branching Negative ALL Write a program that will calculate the product of user-specified negative numbers, in succession, until the user enters done. And then display the final product. Zero is considered positive and the initial product should set to 1. Here is an example run of the program: Enter a number or done to quit:...

  • In Python, write a program that asks the user for a positive integer number. If the...

    In Python, write a program that asks the user for a positive integer number. If the user enters anything else, the program would ask the user to re-enter a number or enter -1 to quit. If it is a positive number, the program then prints out a multiplication table that goes up to that number. For example, if the user enters 10, the output would look something like this. https://www.vectorstock.com/royalty-free-vector/multiplication-table-on-white-background-vector-2721686

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT