From 0136c9aeb74c81c78c5cbd8e7c064babad2c021c Mon Sep 17 00:00:00 2001 From: baphim <269010393+baphim@users.noreply.github.com> Date: Sun, 13 Sep 2026 09:42:45 -0400 Subject: [PATCH] fix(problem-02.py): completed problem-02 --- lab-02/problem-02.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lab-02/problem-02.py b/lab-02/problem-02.py index 901fb3d..2223584 100644 --- a/lab-02/problem-02.py +++ b/lab-02/problem-02.py @@ -1,3 +1,10 @@ # 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. +# Define the function int_check to check if user input is an integer +def int_check(x): + # Cast user input as integer, throws ValueError if not + x = int(x) + +# Call the function, prompting the user to input an integer +int_check(x = input('Enter an integer: ')) \ No newline at end of file