Created
October 5, 2019 04:15
-
-
Save adrianmarkperea/46829eb0456a4432c0ebae4424bb56cc to your computer and use it in GitHub Desktop.
This file contains 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
def sum_all(*args): | |
result = 0 | |
# args is a list | |
for arg in args: | |
result += arg | |
return result | |
result = sum_all(1, 2, 3, 4, 5) | |
print(result) # => 15 | |
# args and kwargs are just arbitrary names | |
# they can be named whatever you like | |
def make_pizza(**toppings): | |
# toppings is a dictionary | |
print(f'Making pizza with {toppings['main']} and extra {toppings['extra']}) | |
make_pizza(main='bacon', extra='cheese') # => Making pizza with bacon and extra cheese | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment