Skip to content

Commit 27923b9

Browse files
committed
default args final.
1 parent 8d5b3cd commit 27923b9

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

code/ch_05_functions/_04_i_ll_have_my_usual.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# start with no defaults...
2-
def display_greeting(name, greeting, times):
2+
def display_greeting(name, greeting='Hello', times=1):
33
times = max(1, times)
44
for _ in range(0, times):
55
print("{} {}!".format(greeting, name))
@@ -11,3 +11,6 @@ def display_greeting(name, greeting, times):
1111
display_greeting("Mark", "Good afternoon")
1212
display_greeting("Mark", "Good afternoon", 2)
1313

14+
display_greeting(greeting='Yo!', name='Michael', times=4)
15+
display_greeting('Michael', times=2)
16+

0 commit comments

Comments
 (0)