Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define the triangle function, to calculate the surface area
- def triangle():
- base = input("Enter the base measurement of the triangle in cm ")
- height = input("Enter the height measurement of the triangle in cm ")
- surface = 0.5 * int(base) * int(height)
- print(str(surface) + " cm3 ")
- triangle()
- #define the reverse function, enter word,gets printed in reverse order
- def reverse():
- question = input("input your word here so we can reverse it ")
- print(question[::-1])
- reverse()
- #define the roll of dice function, ask input for number of attempts, generate random numbers
- def roll_dice():
- import random
- from time import sleep
- outcome = [2,3,4,5,6,7,8,9,10,11,12]
- loop = input("how many times do you want to roll the dice? ")
- for tries in range(int(loop)):
- print(random.choice(outcome))
- sleep(1)
- roll_dice()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement