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 trial

Python Python Basics (2015) Number Game App Squared

Why is this simple bit of code wrong?

I'm not sure why this setup doesn't work. Any input?

def squared(arg):
    return arg * arg
    return arg * len(arg)

3 Answers

Chris Freeman
Chris Freeman
Treehouse Moderator 68,423 Points

The challenge asks you to try converting the argument to an int before squaring. Wrap each arg in int()

Dan Garrison
Dan Garrison
22,457 Points

Here's a hint. The argument entered into the function can either be an integer or a string. In order to multiply a number together, it needs to be turned into an integer. So this is what you should try first. If it fails to turn the argument into an integer then that is where the exception statement will run.