end_number = -99
num = (input("Enter Nnumber: "))
list_of_numbers = []
list_of_numbers.append(num)
while num != end_number:
num = (input("Enter Nnumber: "))
print("The smallest number was", min(list_of_numbers))
print("The smallest number was", max(list_of_numbers))
I am trying to a have a person enter a bunch of int and stop when they ender -99. Then I'm wanting to print the smallest and largest in they entered.
input() returns a string and end_number is int, either convert the result of input() to int, with
num = int(input("Enter Nnumber: "))
or convert end_number to string, with
end_number = "-99" # Double quotes to represent -99 as a String of characters
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With