Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This program asks the user for the base and height of a triangle.
- # It then calculates the area.
- # We will be using functions.
- from time import sleep #imports the sleep function from the time library
- def area(base,height):
- tri_area=0.5*base*height
- return tri_area
- print('****************************************')
- print('******** ********')
- print('******** WELCOME TO THE BOT ********')
- print('******** ********')
- print('****** MASTER PROGRAMMER: FAHIM ******')
- print('******** ********')
- print('****************************************')
- print('Hi, I am the Bot')
- print('')
- sleep(1)
- # Asks the user to enter their name
- user_name=input("What's you name? :>")
- print('Welcome '+user_name+'!')
- print('')
- sleep(1)
- print('We will be working out the area of a triangle.')
- print(' ')
- base=input('What is the base of your triangle? ')
- base=int(base)
- sleep(1)
- height=input('What is the height of your triangle? ')
- height=int(height)
- print(' ')
- sleep(1)
- tri_area = area(base,height)
- print('The area of a triangle with base',base,'and height',height,'is',tri_area)
- print('Good bye')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement