python_exercises/thinkcspy/Chapter-13-Exercises/readposint.py
2023-12-13 09:46:56 -07:00

11 lines
No EOL
357 B
Python

def readposint(num):
try:
val = int(num)
if val > 0:
print("You entered '{}'. That's a positive number!".format(val))
else:
print("'{}' is not a positive number.".format(val))
except Exception:
print("'{}' is not a number.".format(num))
readposint(input("Please enter a positive number: "))