Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. print("Let's practice everything.")
  2. print('You\'d need to know \'bout escapes with \\ that do:')
  3. print('\n newlines and \t tabs.')
  4.  
  5. poem = """
  6. \tThe lovely world
  7. with logic so firmly planted
  8. cannot discern \n the needs of love
  9. nor comprehend passion from intution
  10. and requires an explanation
  11. \n\t\twhere there is none.
  12. """
  13.  
  14. print("----------")
  15. print(poem)
  16. print("----------")
  17.  
  18.  
  19. five = 10 - 2 + 3 - 6
  20. print(f"This should be five: {five}")
  21.  
  22. def secret_formula(started):
  23. jelly_beans = started * 500
  24. jars = jelly_beans / 1000
  25. crates = jars / 100
  26. return jelly_beans, jars, crates
  27.  
  28.  
  29. start_point = 10000
  30. beans, jars, crates = secret_formula(start_point)
  31.  
  32. # remember that this another way to format a string
  33. print("With a starting point of: {}".format(start_point))
  34. #it's just like with an f"" string
  35. print(f"We'd have {beans} beans, {jars} jars, and {crates} crates.")
  36.  
  37. start_point = start_point / 10
  38.  
  39. print("we can also do that this way:")
  40. formula = secret_formula(start_point)
  41. # this is an easy way to apply a list to a format string
  42. print("We'd have {} beans, {} jars, and {} creates.".format(*formula))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement