Advertisement
kaly1

Function_test_prog_102

May 30th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #Write program here :)
  2. from time import sleep
  3. from random import randint
  4.  
  5. def haiku():
  6. print("I don't know")
  7. sleep(1)
  8. print("What a haiku is")
  9. sleep(1)
  10. print("I assume")
  11. sleep(1)
  12. print("It's a short poem")
  13. sleep(1)
  14. print("That doesn't have to rhyme")
  15. sleep(2)
  16.  
  17. def area():
  18. print("\nWe will now calculate the area of a triangle")
  19. base = input("Please enter the base of the triangle in cm:")
  20. height = input("Please enter the height of the triangle in cm:")
  21. area = (float(base) * float(height))/2
  22. print("The area is " + str(round(area,2)) + " cm2")
  23. sleep(2)
  24.  
  25. def coin_flip():
  26. print("\nWe will now toss a coin and see the outcome")
  27. sleep(2)
  28. outcome = randint(1,2)
  29. if outcome == 1:
  30. print("Heads")
  31. else:
  32. print("Tails")
  33.  
  34.  
  35.  
  36. start = input("Press enter to start the haiku")
  37. haiku()
  38. area()
  39. coin_flip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement