Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
516 B
2
Indexable
Never
largest = None
smallest = None

while True:
    num = input("Enter a number: ")

    if num.lower() == 'done':
        break

    try:
        num = int(num)
        if largest is None or num > largest:
            largest = num
        if smallest is None or num < smallest:
            smallest = num
    except ValueError:
        print("Invalid input.")

if largest is not None and smallest is not None:
    print("Maximum:", largest)
    print("Minimum:", smallest)
else:
    print("No valid numbers.")
        
Leave a Comment