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

Challenge 2 is my code too simple?

Hello everyone, i have recently just sat through challenge 2 of python. i struggled with this for quite some time and did a lot of googling until i eventually passed the challenge. However looking back on other students answers for this challenge mine seems a little too simple.

def square(number):
    return number * number

square(3)

result = square(3)

print(result)

Am i on the right path here or was i way off?

2 Answers

Steven Parker
Steven Parker
243,228 Points

Simple is good! As long is it produces the correct result, the more simple the code, the better.

You can be even more simple because for the purposes of the challenge, you only need to define the function, you don't need to call it or to print anything.

Thank you Steve, this is very reassuring news. Greatly appreciated