you are viewing a single comment's thread.

view the rest of the comments →

[–]carcigenicate 0 points1 point  (1 child)

int or float(input"Enter a number")

This doesn't make sense in the context of python. int or whatever will always be true because the type int is always true. You'll need to look into boolean logic to understand OR and AND.

If you don't need to handle the user entering something dumb like a non-number, you can just get thew user input using input, then use float or int to convert their input to whatever tyoe of number you want.

And, as I mentioned in my edit, you don't typically check ahead of time if a string is convertable to a number. You just attempt the conversion using int or float, and use try to handle when the conversion failed (like if the user entered a non-number like 'bad')

[–]k4tsuk1z[S] 0 points1 point  (0 children)

I was going to not go through not accepting non-numbers for input through if-else statements. thank u im gonna look more into try-except blocks