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 Functions and Looping Create a Function

challenge task 2 of 2

squaring.py
def square (number):
    return number * number
result = square ("number")
print(result)

no, sure what i am doing wrong ?

2 Answers

Christian Persaudmata So your first line is defining the function and passing a parameter of "number" into the function. The second line is returning the parameter "number" and multiplying it by itself, so whatever you pass into the function it will be multiplied by itself and returned to the function. Your third line is where your issue lies. Your third line is calling the function and storing its value in the variable "result". The problem is that you are trying to pass the string "number" into the function. So the function is taking the string "number" and trying to multiply it by itself and return that value to you. What you want is to actually pass a numeric value into the function and store that result into the variable "result". So your solution would be to pass a number into the function on line three: for example a solution would to be to replace it with "result = square (3)". Hope this helps!

I have no answer. I have no idea what to do. I can't pass this point and I have no clue how to solve it. I have been taking notes on every video. I pause the video and type everything the video does. I don't Know how to save anything I learn in REBL so all that is gone I can't remember it all. I am very unhappy with this course. I just purchased a python 3 course on UDEMe and I own it at 89$ compared to a subscription that costs 200$ a month. that locks me out on week one of the subscription. I feel scammed and I want my money back. I paid 200$ on November 15 and 1 hour of video takes 3 hours to stop it and take notes. I would not have passed any of the other check points if I had not taken notes. I am very displeased with this Raquet. I have to phone a friend via team treehouse website and wait for an email before I can move on. I feel like I should have half a clue since I am paying to learn,