it's homework from udemy,my solution cant work,here is the question:
Write a function that asks for an integer and prints the square of it. Use a while loop with a try, except, else block to account for incorrect inputs. here is my solution:
def ask(): while True: try: user_input = int(input('give me int energe:')) squ = user_input**2 print('boom! show you my power:'+squ) except: print('lack of int energe') continue else: print('Gotcha') break finally: print('boooooom') pass if I input str, the exception works well but even I input an int also show the same result as str,why this happens?? 
here is the correctly solution:
def ask(): while True: try: n = int(input('Input an integer: ')) except: print('An error occurred! Please try again!') continue else: break print('Thank you, your number squared is: ',n**2) I am not sure why my attempt cant going well