In Python, pass
is how you indicate that nothing happens; you shouldn't just put None
on a line on its own. Alternatively, note that:
if x:
pass
else:
y()
is the same as:
if not x:
y()
except that the latter is much neater.
You are right that the repeated int
is bad form. You might find Asking the user for input until they give a valid responseAsking the user for input until they give a valid response useful in helping you refactor to make number
an int
as early as possible.