Question

Write a Python program that asks users to input 10 float numbers (using a while statement),...

Write a Python program that asks users to input 10 float numbers (using a while statement), and print the minimum number.

Homework Answers

Answer #1

# python code

import sys

i = 0
min = sys.float_info.min
while True:
   number = float(raw_input("Enter a number: "))
   if number < min:
       min = number
   i = i + 1
   if i == 10:
       break

print "\nMinimum number: ", min


'''
output:

Enter a number: 4
Enter a number: 5
Enter a number: -1
Enter a number: -10.6
Enter a number: 55.4
Enter a number: -0.56
Enter a number: -4.2
Enter a number: 10
Enter a number: 5
Enter a number: 6

Minimum number: -10.6

'''


Know the answer?
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
Similar Questions
Write a program to input 6 numbers. After each number is input, print the biggest of...
Write a program to input 6 numbers. After each number is input, print the biggest of the numbers entered so far. Please use python and include a screenshot that the code is running. Please use simple code as I am only a high school student.
Please use Python 3 4). Write a program that asks the user to enter 10 numbers....
Please use Python 3 4). Write a program that asks the user to enter 10 numbers. The program should store the numbers in a list and then display the following data: • The lowest number in the list • The highest number in the list •The total of the numbers in the list • The average of the numbers in the list   Sample input & output: (Prompt) Enter Number 1: (User enter) 4 (Prompt) Enter Number 2: (User enter) 7...
Question1: Write a Python Program that asks for the grades of 5 quizzes and then prints...
Question1: Write a Python Program that asks for the grades of 5 quizzes and then prints the highest grade. [6 Marks] Question2: Write a Python Program that does the following tasks. [8 Marks] Create an empty list Ask the user for 5 positive numbers and append them to the list Find and print the sum of all the numbers in the list Delete the last element from the list and then print the list Question3: Consider you have the following...
IN PYTHON : Write a program that asks the user for a number. Write the number...
IN PYTHON : Write a program that asks the user for a number. Write the number to a file called total.txt. Then ask the user for a second number. Write the new number on line 2 with the total for both numbers next to it separated by a comma. Then ask the user for a third number and do the same. Keep asking for numbers until the person puts in a zero to terminate the program. Close the file. Be...
1)Write a program that asks a user for a number. If (and only if) the number...
1)Write a program that asks a user for a number. If (and only if) the number is greater than zero print “The number is valid” 2)Write a program that asks a user for a grade. If (and only if) the grade is greater than zero and less than 101, print “The grade is valid” 3)Write a program that asks a user how many widgets they want to buy and prints out what the user should pay. Widgets costs 10 dollars....
Write a Python program using that takes a number as input and then prints if the...
Write a Python program using that takes a number as input and then prints if the number is even or odd. The program should use a function isEven that takes a number as a parameter and returns a logical value true if the number is even, false otherwise.
a. Exercise 10-6 from Python Crash Course: One common problem when prompting for numerical input occurs...
a. Exercise 10-6 from Python Crash Course: One common problem when prompting for numerical input occurs when people provide text instead of numbers. When you try to convert the input to an int, you'll get a ValueError. Write a program that prompts the user to input two numbers. Add them together and print the result. Catch the ValueError if either input value is not a number, and print a friendly error message. Test your program by entering two numbers and...
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except...
using Python: Write a function named safe input(prompt,type) that works like the Python input function, except that it only accepts the specified type of input. The function takes two arguments: r prompt: str r type: int, float, str The function will keep prompting for input until correct input of the specified type is entered. The function returns the input. If the input was specified to be a number ( float or int), the value returned will be of the correct...
- Write a Python program which asks the user to enter a number, if the number...
- Write a Python program which asks the user to enter a number, if the number is divisible by 6 or 7, the program prints “The number X is divisible by 6 or 7” and if the number is neither divisible by 6 nor by 7, then it prints “The number X is not divisible by 6 and 7”.
Write a full C++ program to read a series of integer numbers from standard input and...
Write a full C++ program to read a series of integer numbers from standard input and print them out in reverse order, one per line. You may assume that there will be a minimum of 2 numbers to read and a maximum of 200.
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT