Saturday, July 19, 2014

Day 105

Python at CodeCademy. Worked on Python tutorial 12 of 19, Functions, On Beyond Strings! Checked out some built-in functions.

The code used:
def biggest_number(*args):
    print max(args)
    return max(args)
    
def smallest_number(*args):
    print min(args)
    return min(args)

def distance_from_zero(arg):
    print abs(arg)
    return abs(arg)

biggest_number(-10, -5, 5, 10)
smallest_number(-10, -5, 5, 10)
distance_from_zero(-10)

The code for this interaction:
10
-10
10

No comments:

Post a Comment