Files
cybr108/lab-02/problem-07.py
T
2026-09-13 16:46:04 -04:00

10 lines
390 B
Python

# 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.')