Find answers to your most challenging questions with the help of IDNLearn.com's experts. Get accurate and detailed answers to your questions from our dedicated community members who are always ready to help.

python exercise grade 10

Write a program that finds the largest in a series of numbers entered by the user. The program
must prompt the user to enter numbers one by one. When the user enters 0 or a negative
number, the program must display the largest nonnegative number entered:
Enter a number: 60
Enter a number: 38.3
Enter a number: 4.89
Enter a number: 100.62
Enter a number: 75.2295
Enter a number: 0
The largest number entered was 100.62
Notice that the numbers aren’t necessarily integers


Sagot :

nums = []

while True:

   num = float(input("Enter a number: "))

   if num <= 0:

       break

   nums.append(num)

print("The largest number entered was",max(nums))

I wrote my code in python 3.8. I hope this helps.

Thank you for using this platform to share and learn. Keep asking and answering. We appreciate every contribution you make. Thank you for visiting IDNLearn.com. We’re here to provide dependable answers, so visit us again soon.