Previous Lecture Complete and continue  

  Square a Number

Notes to Help You

  • Functions start with def
  • Don't forget your colons
  • Always return in functions rather than print!

Example Problem.
Write a function add_two that takes in two numbers as input and returns their sum.

Adex Elizy
it's not printing your code is correct
because you haven't called the test_square_number function
Phuc Le
def square_number(number):
return squared
Zsolt Bisztray
ashish dagar
def square_number(number):
return number**2

Sebastian Gomez
Thomas Liebig
def square_number(a):
return a * a
Tao Burga
huhhhh I've been trying for about an hour and when i gave up and saw the solution it was just as i had done it its just nothing would happen. i kept getting this:
IndentationError: unindent does not match any outer indentation level on line 25 test_square_number() ^ in
heres my link in case you want to check it out:
Tara Fahey
Six days late but eh. Your code wasn't wrong, per say, the only problem was that the last line ( the line that tests your code) had a single space throwing off the entire program. Simply get rid of that space and it'll work.

def square(number):
return number*number
print (square(2))

for i in range(12):