So I want to ask the user how old he is in Python. I want to give an assertion error when the input is 0 or lower and when the input is not an integer, so for example the user types something like a comma or something else. This is what I have now
test = input("How old are you?: ")
assert test > 0 and type(test) == int, "Must be more than 0 and only numbers"
And this doesn't work, because when the user types in an integer like 15, it is considered a string and > is not allowed between a string and an integer. So I tried to make the input an integer, like this:
test = int(input("How old are you?: "))
assert test > 0 and type(test) == int, "Must be more than 0 and only numbers"
This above works for the first assert. When the user puts as input -1 or 0, it gets an assertion error. However, it does not work for the second assert, because the type is already an integer. How can I solve this?