Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, November 27, 2012

Codecademy: "Review: Built-in Functions"


//sample solution


def distance_from_zero(param):
if (type(param) is int) or (type(param) is float):
return abs(param)
else:
return "This isn't an integer or a float!"

print distance_from_zero(-1)
print distance_from_zero(-2.13)
print distance_from_zero("A string.")

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts