forked from spierre91/medium_code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefine_function2.py
More file actions
29 lines (18 loc) · 863 Bytes
/
Copy pathdefine_function2.py
File metadata and controls
29 lines (18 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
def sum_function(first, second):
return (first + second)
print("Sum: ", sum_function(5, 10))
def sum_arbitrary_arguments(first, *rest):
return (first + sum(rest))
print("Sum with arbitrary number of arguments: ", sum_arbitrary_arguments(5, 10,15))
print("Sum with arbitrary number of arguments: ", sum_arbitrary_arguments(5, 10,15, 20, 25, 30))
def print_weather(name, state = "New York", temp = "30 degrees Celsius"):
print("Hi {}, it is {} in {}".format(name, temp, state))
print_weather("Sarah")
print_weather("Mike", "Boston", "28 degrees Celsius")
def print_weather_kwargs(**kwargs):
weather_report = ""
for argument in kwargs.values():
weather_report += argument
return weather_report
kwargs = { 'temp':"30 degrees Celsius ", 'in':'in', 'State':" New York", 'when': ' today'}
print(print_weather_kwargs(**kwargs))