+ 1
How can I put only positive number in "input"? If someone puts negetive number values ,It will show error.
AGE is always positive number
3 Respostas
+ 9
You can also you if-else condition.
If user enters a negative age then says that try again.
# here is some code
if age <= 0:
print("Wrong input. Try again")
else:
# continue with your code here
+ 3
use catch exeption
+ 3
You can try the absolute function: abs(-16) // return 16