Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #http://learnpythonthehardway.org/book/ex19.html
- #create the function and set two arguments
- def cheese_and_crackers(cheese_count, boxes_of_crackers):
- print ("you have {} cheeses".format(cheese_count))
- print ("You have {} boxes of crackers".format(boxes_of_crackers))
- print ("Man that's enough for a party!")
- print ("We can just give the function numbers directly:")
- cheese_and_crackers(20,40)#this is where he calls the function!
- print()
- print ("OR, we can use variables from our script:")
- amount_of_cheese =10
- amount_of_crackers=50
- print()
- cheese_and_crackers(amount_of_cheese, amount_of_crackers)
- print ("we can even do the math inside too:")
- cheese_and_crackers(10+20, 5+6)
- print("And we can combine the two, variables and math:")
- cheese_and_crackers(amount_of_cheese +100, amount_of_crackers +1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement