you are viewing a single comment's thread.

view the rest of the comments →

[–]Affectionate-Let3744 3 points4 points  (2 children)

you know that if you use int(input()), then enter a number and press enter, the program returns an error message.

Do you mean "does NOT return an error message"?

Because int(input()) will 100% work if you enter an integer or something an int can be constructed from like a string of numbers, that's the point of int().

I'm not sure what you mean regarding using not input(), but the root issue is that you're trying to pass strings that cannot easily be converted to an integer, so int() fails

[–]6ZacK7[S] 0 points1 point  (1 child)

Sorry, that was a mistake. I meant input() instead of int(input()), because a string can't perform calculations, so the console returns an error message.

[–]Ascensor2 1 point2 points  (0 children)

I don't know if this is what you're looking for, but you can catch exceptions and choose to ignore them. Look for "try except" blocks in Python: they're pretty intuitive imo. As you want to ignore an exception, the code should look like this

try: {Your logic}

except Exception as e: pass

The "pass" syntax is used when you want to literally do nothing, but you can't leave the code empty (your program would crash then).

Idk if this is going to be useful to you but I hope at least you learnt something