Advertisement
jamesdiop

programming102FirstTest

Apr 23rd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # haiku function function
  2. poem = ["Have we not known, nor heard, nor read",
  3.         "How God does hate deceit and wrong?",
  4.         "How Ananias was struck dead,",
  5.         "Caught with a lie upon his tongue?"]
  6. def display_haiku():
  7.     for line in poem:
  8.         print(line)
  9. display_haiku()
  10.  
  11.  
  12. #Triangle area function
  13. def triangle_area():
  14.     height = float(input('Enter the height of the triangle: '))
  15.     base = float(input('Enter the base of the triangle: '))
  16.     area = 1/2 * height * base
  17.     print('The area of the triangle is:',area)
  18.     triangle_area()
  19.  
  20.  
  21. # heads and tails function
  22. import random
  23. def heads_or_tails():
  24.     r =random.randint(0,1)
  25.     if r == 0:
  26.         print('heads')
  27.     if r == 1:
  28.         print('tails')
  29.        
  30. heads_or_tails()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement