Advertisement
xavicano

Untitled

Jul 30th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.43 KB | None | 0 0
  1. import random
  2.  
  3. def triangle_area():
  4.     print("Calculates the area of a triangle")
  5.     height = input("Height of the triangle?")
  6.     base = input("Length of the base of the triangle?")
  7.     area = (int(base) * int(height))/2
  8.     print ("The area is ", area, " m^2")
  9.    
  10. def coin_flip():
  11.     if random.randint(0,1)==0:
  12.         coin="heads"
  13.     else:
  14.         coin="tails"
  15.     print (" The coin has fallen showing ", coin)
  16.    
  17.    
  18. triangle_area()
  19.  
  20. coin_flip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement