feat: completed problem-07.py

This commit is contained in:
baphim
2026-09-13 16:46:04 -04:00
parent 2b2913cb7f
commit b697cfcd66
+8
View File
@@ -1,2 +1,10 @@
# Write a Python program that prompts the user to input a number and handles a KeyboardInterrupt exception if the user
# cancels the input.
# Prompt user to input a number and try if the input is cancelled
try:
input('Enter a number: ')
# Handle the expected KeyboardInterrupt exception
except KeyboardInterrupt:
# Print termination message
print('Program terminated by user.')