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 trialKhaja Ahmed
198 PointsAssertionError: 5 != 1 :
def square (number):
return number * 5
1 Answer
Steven Parker
231,275 PointsThe message may be a little confusing, but the instructions asked for a function that would square the passed argument, but that's not what this code is doing.
One way to calculate a square would be to multiply the value by itself, but multiplying by 5 would only create a square if the argument was also 5 (and the tester obviously tries other values).
Khaja Ahmed
198 PointsKhaja Ahmed
198 Pointsi still didn't get it i am new to programming.
Steven Parker
231,275 PointsSteven Parker
231,275 PointsYou can't use "5" because that would only work if the argument was 5. To get a square, you must multiply the number by itself (so instead of "
number * 5
", you might write "number * number
").