Answer to Question #97177 in Python for Priscilla Castaneda

Question #97177
Write a program to input 6 numbers. After each number is input, print the biggest of the numbers entered so far.

Example:

Enter a number: 1
Largest: 1
Enter a number: 3
Largest: 3
Enter a number: 4
Largest: 4
Enter a number: 9
Largest: 9
Enter a number: 3
Largest: 9
Enter a number: 5
Largest: 9
(Please answer I've been stuck on this problem for days)
1
Expert's answer
2019-10-23T07:57:31-0400

largest = None

for i in range(0,6):

  d = int(input("Enter a number: "))

  if not largest or d > largest:

    largest = d

  print("Largest: " + str(largest))



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS