Python Python Basics Functions and Looping Create a Function

Harwood Jones
Harwood Jones
1,377 Points

Defining the function

I'm not sure if I'm way off or not. Am I defining correctly?

squaring.py
import math

def square(number)
    return number * number

number = int(input())
lemelleio
lemelleio
10,144 Points

EDIT woops sorry, didn't see the second step.

There's no need to import math in this challenge. Also the challenge asks you to assign the output of your function to "result"

you only need the following:

def square(number):
    return number * number

result = square(3)

2 Answers

Miss Lucy Andresen
Miss Lucy Andresen
388 Points
def square(TheNumber):
    return number * number

number = int(input("please insert a number"  ))
the_ancear = square(number)
print("the square root of {} is".format(number),the_ancear)

your missing some dots and the name of the def was the same as the input they need to be different names I also put in some user text and a print statement with a bit of formatting to see what you are doing

Taurai Mashozhera
Taurai Mashozhera
2,308 Points

You forgot to put the colons after defining the function . def square(number): return number*number There is no need of importing math and using the input method because it is not asked for.

Happy coding