Advertisement
kevinbocky

haiku_triangle_coin.py

Jan 22nd, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #define the haiku funtion
  2. def haiku():
  3. from time import sleep
  4. print(haiku_line1)
  5. sleep(2)
  6. print(haiku_line2)
  7. sleep(2)
  8. print(haiku_line3)
  9.  
  10.  
  11. haiku_line1 = "Relax, the future"
  12. haiku_line2 = "is already unfolding"
  13. haiku_line3 = "from long-planted seeds"
  14. haiku()
  15.  
  16. #define the triangle function, to calculate the surface area
  17. def triangle():
  18. base = input("Enter the base measurement of the triangle in cm ")
  19. height = input("Enter the height measurement of the triangle in cm ")
  20. surface = 0.5 * int(base) * int(height)
  21. print(str(surface) + " cm3 ")
  22.  
  23. triangle()
  24.  
  25. #define the coin flip function, it must ramdonly generate an outcome
  26. def coin_flip():
  27. import random
  28. print("Lets flip a coin")
  29. option = ["Heads", "Tails"]
  30. result = random.choice(option)
  31. print("The result is " + result)
  32.  
  33. coin_flip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement