Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import random
- def linebyline(poem):
- # Function to print each line of a haiku
- for line in poem:
- print(line)
- def triangle():
- # Function to calculate area of triangle
- height = float(input("what is the height of the triangle ? "))
- base = float(input("and what is the base length of the triangle ? "))
- area = (base / 2) * height
- print("The area of that triangle would be {} ".format(area))
- def flip():
- # Function to simulate a coin flip
- side = random.randint(0,1)
- if side == 0:
- print("Heads")
- else:
- print("Tails")
- # Now call the functions
- text = ('Whitecaps on the bay','A broken signboard banging','In the April wind.')
- linebyline(text)
- triangle()
- flip()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement