Advertisement
Fahim999

Untitled

Dec 6th, 2019
681
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. # This program asks the user for the base and height of a triangle.
  2. # It then calculates the area.
  3. # We will be using functions.
  4.  
  5. from time import sleep  #imports the sleep function from the time library
  6.  
  7. def area(base,height):
  8.     tri_area=0.5*base*height
  9.     return tri_area
  10.    
  11. print('****************************************')
  12. print('********                        ********')
  13. print('********   WELCOME TO THE BOT   ********')
  14. print('********                        ********')
  15. print('******  MASTER PROGRAMMER: FAHIM  ******')
  16. print('********                        ********')
  17. print('****************************************')
  18. print('Hi, I am the Bot')
  19. print('')
  20. sleep(1)
  21.  
  22. #   Asks the user to enter their name
  23. user_name=input("What's you name? :>")
  24. print('Welcome '+user_name+'!')
  25. print('')
  26. sleep(1)
  27.  
  28. print('We will be working out the area of a triangle.')
  29. print(' ')
  30. base=input('What is the base of your triangle? ')
  31. base=int(base)
  32. sleep(1)
  33.  
  34. height=input('What is the height of your triangle? ')
  35. height=int(height)
  36. print(' ')
  37. sleep(1)
  38.  
  39. tri_area = area(base,height)
  40.  
  41. print('The area of a triangle with base',base,'and height',height,'is',tri_area)
  42. print('Good bye')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement