Answers for "python for everybody chapter 5.2 assignment"

0

python for everybody chapter 5.2 assignment

num = 0
largest = -1
smallest = None
while True:
    num = input("Enter a number: ")
    if num == "done" :
        break
    try :
        numb = int(num)
    except :
        print('Invalid input')
    if smallest is None :
        smallest = numb
    elif numb < smallest :
        smallest = numb
    elif numb > largest :
        largest = numb
print("Maximum is", largest)
print("Minimum is", smallest)
Posted by: Guest on January-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language