Skip to content

Instantly share code, notes, and snippets.

@jjlumagbas
Created September 1, 2016 02:16
Show Gist options
  • Save jjlumagbas/f9648f3ed8070a4cb958f53cd9e9f2b0 to your computer and use it in GitHub Desktop.
Save jjlumagbas/f9648f3ed8070a4cb958f53cd9e9f2b0 to your computer and use it in GitHub Desktop.
# 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