Skip to content

Commit 3bd1b74

Browse files
committed
added exercise 18
1 parent 466849b commit 3bd1b74

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

ex18.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# this one is like your scripts with argv
2+
def print_two(*args):
3+
arg1, arg2 = args
4+
print "arg1: %r, arg2: %r" % (arg1, arg2)
5+
6+
# ok, that *args is actually pointless, we can just do this
7+
def print_two_again(arg1, arg2):
8+
print "arg1: %r, arg2: %r" % (arg1, arg2)
9+
10+
# this just takes one argument
11+
def print_one(arg1):
12+
print "arg1: %r" % arg1
13+
14+
# this one takes no arguments
15+
def print_none():
16+
print "I got nothin'."
17+
18+
print_two("Zed","Shaw")
19+
print_two_again("Zed","Shaw")
20+
print_one("First!")
21+
print_none()

0 commit comments

Comments
 (0)