Functions lesson 4


#1



it says invalid syntax how do you define square as 10?


def square(10):
    """Returns the square of a number."""
    squared = n**2
    print "%d squared is %d." % (n, squared)
    return squared
 
    
square()


#2

Here in the parentheses you should have the variable n.

But here, In the parentheses you can put any number you like. :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.