Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- This program creates a haiku function
- """
- def my_haiku():
- haiku=[]
- howmanylines=int(input("How many lines do you want your poem to have? "))
- for item in range(howmanylines):
- lines=input("Here is the line indexed to number "+str(item)+": ")
- item+=1
- haiku.append(lines)
- for line in haiku:
- print(line)
- my_haiku()
- """
- This program calculates and prints out an area of triangle after
- asking inputs from the user, assumming the height and base are in cm
- """
- def area_triangle():
- height=int(input("What is the height of your triangle? "))
- base=int(input("What is the base of your triangle? "))
- area = 0.5*height*base
- print("The area of triangle is: ",area,"centimeter squared")
- area_triangle()
- """
- function that simulates a coin flip.
- """
- import random
- def toss_coin():
- coin_face=["head","tail"]
- random.shuffle(coin_face)
- for item in coin_face:
- random.shuffle(coin_face)
- print(item)
- toss_coin()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement