Advertisement
pleabargain

Python3 the hard way exe 19

May 4th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. #http://learnpythonthehardway.org/book/ex19.html
  2.  
  3. #create the function and set two arguments
  4. def cheese_and_crackers(cheese_count, boxes_of_crackers):
  5.     print ("you have {} cheeses".format(cheese_count))
  6.     print ("You have {} boxes of crackers".format(boxes_of_crackers))
  7.     print ("Man that's enough for a party!")
  8.  
  9.  
  10. print ("We can just give the function numbers directly:")
  11. cheese_and_crackers(20,40)#this is where he calls the function!
  12. print()
  13.  
  14. print ("OR, we can use variables from our script:")
  15. amount_of_cheese =10
  16. amount_of_crackers=50
  17.  
  18. print()
  19. cheese_and_crackers(amount_of_cheese, amount_of_crackers)
  20.  
  21. print ("we can even do the math inside too:")
  22. cheese_and_crackers(10+20, 5+6)
  23.  
  24. print("And we can combine the two, variables and math:")
  25. cheese_and_crackers(amount_of_cheese +100, amount_of_crackers +1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement