Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Exercise 18: Names, Variables, Code, Functions
- #http://learnpythonthehardway.org/book/ex18.html
- #this one is like argv
- def print_two (*args):# never seen * args!
- arg1, arg2 =args
- print ("arg1: {}, arg2: {}".format(arg1, arg2))
- #ok, that *args is pointless, we can just do
- def print_two_again(arg1,arg2):
- print ("arg1: {}, arg2 {}".format(arg1,arg2))
- #this one takes just one argument
- def print_one(arg1):
- print ("arg1: {}".format(arg1))
- #this takes no arguments
- def print_none():
- print ("I got nuthin!")
- #Now call the functions by naming them and supplying arguments
- print_two("D","GD")
- print_two_again("me","I")
- print_one("first")
- print_none()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement