Functions lesson 4


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


Here in the parentheses you should have the variable n.

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


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