Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialahmed salah
9,195 Pointsdef squared(arg): try: return int(arg)**2 except: return arg*2 it work on my computer
squared.py falied
def squared(arg):
try:
return int(arg)**2
except:
return arg*2
1 Answer
Ismail KOÇ
1,748 PointsHi ahmed, if argument's data type is integer, function will return squared argument, else (except ValueError: ) function return multiple argument with length of argument argument (for ex: squared('aa') -----> return len('aa')*'aa' -----> aaaa)
Ismail KOÇ
1,748 PointsIf you need help, do not hesitate ask me.
ahmed salah
9,195 Pointsahmed salah
9,195 Pointsoh, i didn't read the specs correctly it required to multiply in case of string by it's length :)