Thursday, July 10, 2014

Day 96

Python at CodeCademy. Worked on Python tutorial 3 of 19, Functions, Call and Response! Worked on defining a function and calling it to be implemented.

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

The interaction for this code looked like this:
10 squared is 100.

No comments:

Post a Comment