Welcome to the Treehouse Community
Looking to learn something new?
I can get this to run in my editor using print. I am not sure what I am missing to pass the exercise. Thanks for the help.
# EXAMPLES # squared(5) would return 25 # squared("2") would return 4 # squared("tim") would return "timtimtim" def squared(num): try: return (num ** 2) except (TypeError, NameError, ValueError): return str(num) * len(str(num))
james southFront End Web Development Techdegree Graduate 33,258 Points
int cast num in your try block and it will pass. (int)num is how you cast to int. if it can't, it goes to the except block.
Thanks Alexey. It was running fine in my editor and I figured that the exercise was wanting something particular. Really appreciate the help!!