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

Sunday, November 25, 2012

Codecademy: "Review: Built-In Functions"


#sample solution


def distance_from_zero(param):
if(isinstance(param,(int,float))):
return abs(param)
else:
return "This isn't an integer of 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