144,295 views
18 votes
18 votes
In Python: Write a program to input 6 numbers. After each number is input, print the smallest of the numbers entered so far.

Sample Run:
Enter a number: 9
Smallest: 9
Enter a number: 4
Smallest: 4
Enter a number: 10
Smallest: 4
Enter a number: 5
Smallest: 4
Enter a number: 3
Smallest: 3
Enter a number: 6
Smallest: 3

User Godwhacker
by
2.7k points

1 Answer

14 votes
14 votes

Answer:

python

Step-by-step explanation:

list_of_numbers = []
count = 0
while count < 6:
added_number = int(input("Enter a number: "))
list_of_numbers.append(added_number)
list_of_numbers.sort()
print(f"Smallest: {list_of_numbers[0]}")
count += 1

User Sasidhar Boddeti
by
2.7k points