Created
September 1, 2016 02:16
-
-
Save jjlumagbas/f9648f3ed8070a4cb958f53cd9e9f2b0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a function that given a number, | |
# computes the value of the number times 2 | |
# def twice(n): | |
# """ | |
# (number) -> number | |
# Produce twice the value of the given number | |
# """ | |
# return 0 | |
# def twice(n): | |
# """ | |
# (number) -> number | |
# Produce twice the value of the given number | |
# """ | |
# return ... n | |
def twice(n): | |
""" | |
(number) -> number | |
Produce twice the value of the given number | |
""" | |
return n * 2 | |
print(twice(2)) # 2 * 2 | |
print(twice(3)) # 3 * 2 | |
print(twice(2.5)) # 2.5 * 2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment