r/pythonhelp • • Jan 16 '21

Not sure what I’ve done wrong. Does anyone know?

Post image
5 Upvotes

5 comments sorted by

1

u/socal_nerdtastic Jan 16 '21

What is this supposed to do? To find the biggest number just use the max function:

max(numbers)

1

u/Mr_Neonz Jan 16 '21

It’s supposed to get input to put together a list of numbers and then determine the largest number in the list. It gives you the option to either add a number or not add a number, if you say no, it for some reason goes to the else statement and says that it doesn’t understand instead of registering the the input as no and seeing if there are values in the list of numbers. Now if you actually say yes and add a number it says that the input was not a number instead of appending the integer input to a list. I’m sorry I should’ve been more clear in the title.

1

u/socal_nerdtastic Jan 16 '21

if you actually say yes and add a number it says that the input was not a number

That is because you need Addnum != int will ALWAYS be True. You need if not isinstance(Addnum, int) instead.

1

u/Mr_Neonz Jan 16 '21

Thank you for the help, sorry if I confused you I’m a beginner.

1

u/socal_nerdtastic Jan 16 '21

seeing if there are values in the list of numbers

if numbers == True does not check if there are values in the list of numbers. You need if bool(numbers) == True for that, or simply if numbers.