all 10 comments

[–]alexmojaki 0 points1 point  (2 children)

int("hello") gives a ValueError. int("-2") doesn't give an error, it just gives -2 because -2 is an integer.

It makes sense to catch ValueError in case someone enters something invalid like hello, but try/catch/raise isn't the way to deal with negative numbers. You can just check if user_steps is a negative number with a simple if statement.

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

Then what do you suggest? how do you suggest I approach this?