Advertisement
pleabargain

python 3 the hard way exe 24

May 4th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. #learn python the hard way http://learnpythonthehardway.org/book/ex24.html
  2. #I get a tuple error when I run this
  3. #don't know why and I'm done searching for the time being
  4. #
  5. print ("Let's practice everything.")
  6.  
  7. print ("You\'d need to know \'bout escapes \\ that create \n newlines and \t tabs.")
  8.  
  9. poem = """
  10. \tThe lovely world
  11. with logic so firmly planted
  12. cannot discern \n the needs of love
  13. nor comprehend passion from intuition
  14. and requires an explanation
  15. \n\t where there is none.
  16. """
  17.  
  18. print ("-"*50)
  19. print (poem)
  20. print ("-"*50)
  21.  
  22.  
  23. five = 10-2+3-6
  24. print ("This should be five: {}".format(five))
  25.  
  26. def secret_formula(started):
  27.     jelly_beans= started *500
  28.     jars = jelly_beans / 1000
  29.     crates = jars / 100
  30.     return jelly_beans, jars, crates
  31.  
  32. start_point = 10000
  33. beans, jars, crates = secret_formula(start_point)
  34.  
  35. print ("With a starting point of: {}".format(start_point))
  36. print ("We'd have {} beans, {} jars, and {} crates.".format(beans, jars, crates))
  37.  
  38. start_point = (start_point /10)
  39.  
  40. print ("We can also do that this way: ")
  41. print ("Start point",start_point)
  42. print ("secret formula", str(secret_formula))
  43. print ("We'd have {} beans, {} jars, and {} crates.".format(secret_formula(start_point)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement