Skip to content

Commit

Permalink
add ex18.py
Browse files Browse the repository at this point in the history
  • Loading branch information
cody33231 committed Nov 19, 2016
1 parent 8516e92 commit 7b192d2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions ex18.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# --coding=utf-8--
#this one is like your scripts with argv

def print_two(*arg):
arg1,arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)

#ok,that* args is actually pointless, we can just do this
def print_two_agin(arg1,arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)

#this just takes one argument
def print_one(arg1):
print "arg1: %r" % arg1

#this one takes no arguments
def print_none():
print "I got nothin'."


print_two("Zed","Shaw")
print_two_agin("CC","DD")
print_one("Peter")
print_none()

0 comments on commit 7b192d2

Please sign in to comment.