Skip to content

Instantly share code, notes, and snippets.

@JeffersGlass

JeffersGlass/success.py Secret

Created Dec 1, 2020
Embed
What would you like to do?
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