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

mohan Abdul
PLUS
mohan Abdul
Courses Plus Student 1,453 Points

the code works in workspace but not working in "verifying" or checking tool box of challenge.

What am I missing? it works in works space. I found this challenge extremely difficult to crack, it took me about 3 hrs

squaring.py
import math

def square (number):
    return math.ceil(number * number)

number = int(input("Please enter number")

end_result = square(number)
print(" The sum is {}.".format(end_result))
mohan Abdul
mohan Abdul
Courses Plus Student 1,453 Points

I am aware that """number = int(input("Please enter number")""" is missing a closing perin at the end as it an "int" in it

mohan Abdul
mohan Abdul
Courses Plus Student 1,453 Points

Understandably thus thread has gone since xmas and new years round the corner. (i hope everyone had a good xmas, and great new year!). Can any one help me?

2 Answers

Seth Kroger
Seth Kroger
56,414 Points

While your code works you're not doing precisely what the challenge asks. It doesn't ask you to input any number so you don't need to do that. You just need to call your square() function with a specific number and store the answer in the variable result.

mohan Abdul
mohan Abdul
Courses Plus Student 1,453 Points

thanks i didnt need to all those lines, it was just the function and the function body. happy new year.

mohan Abdul
mohan Abdul
Courses Plus Student 1,453 Points

I guess i have trouble understanding the question and to see what it is asking me, i done too much for this task.

You are doing way more than necessary. For task 1 just return the number times itself:

def square (number):
    return (number * number)
mohan Abdul
mohan Abdul
Courses Plus Student 1,453 Points

KRIS NIKOLAISEN i have done as you habe suggested, the code works in workspace, but still no avail in the code challenge verfication. https://w.trhou.se/vd094lw0rs . I have a few files in that link so please click on ""return_test.py"" in the files folder and you'll see i done as you have suggested. thanks i really appreciate the help.

mohan Abdul
mohan Abdul
Courses Plus Student 1,453 Points

KRIS NIKOLAISEN, i hope you had a good xmas and finish the new year on a good note, if your available i was wondering if you could help me with this problem. i have done as you have suggested.