feat: completed problem-02
This commit is contained in:
@@ -1,2 +1,9 @@
|
||||
# Problem 2: Write a Python program that prompts the user to input an integer and raises a ValueError exception if the
|
||||
# input is not a valid integer.
|
||||
|
||||
try:
|
||||
# Prompt user to enter an integer
|
||||
integer = int(input("Enter any integer: "))
|
||||
print(f"{integer} is an integer.")
|
||||
except ValueError:
|
||||
print("That is not an integer, try again.")
|
||||
Reference in New Issue
Block a user