Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass
Created December 1, 2020 16:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffersGlass/f5d52dc0a2d5b5b8af53c9edb27e5337 to your computer and use it in GitHub Desktop.
Save JeffersGlass/f5d52dc0a2d5b5b8af53c9edb27e5337 to your computer and use it in GitHub Desktop.
def success(*args):
"""Prints a statement to the console that the numbers given as arguments sum to 2020 and prints their product
"""
print("Found that ", end = "")
product = 1
for i in range(len(args)):
print(f"{args[i]}", end = "")
if i < len(args)-1: print(" and ", end = "")
product *= args[i]
print (f" sum to 2020; their product is: {product}")
#Original implemenetation of this function that accepted only two arguments:
#print(f"Found that {first} and {second} sum to 2020; their product is {first*second}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment