Question: (20p) 2. Create a Python program that takes an integer as user input and tries to convert it to the int type. If the user

(20p) 2. Create a Python program that takes an integer as user input and tries to convert it to the int type. If the user input is not an integer, the exception raised should be handled with the message Error: You did not enter an integer. If the user input is a valid integer, the program should check if it is larger than zero, and print the square of the entered number if it is. If the user input is not larger than zero, the program should print Sorry, I only work with positive integers. At the very end of the program, the message -- End of Program -- should be printed to the console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!