Python Python Basics Functions and Looping Create a Function

mohan Abdul
PRO
mohan Abdul
Pro 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
Pro 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
Pro 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,369 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
Pro 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
Pro 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
Pro 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
Pro 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.