SHARE
TWEET

Untitled

Fahim999 Dec 3rd, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. print('****************************************')
  2. print('********                        ********')
  3. print('********   WELCOME TO THE BOT   ********')
  4. print('********                        ********')
  5. print('******  MASTER PROGRAMMER: FAHIM  ******')
  6. print('********                        ********')
  7. print('****************************************')
  8.  
  9. print('Hi, I am the Bot')
  10. print('')
  11.  
  12. #   Asks the user to enter their name
  13. user_name=input("What's you name? :>")
  14. print('Welcome '+user_name+'!')
  15. print('')
  16.  
  17. finished = False
  18. while finished == False:
  19.     command=input("Please type 'Add' or 'add' if you want to add 2 numbers :>")
  20.  
  21.     # This is the code for adding
  22.     if command == 'Add' or command == 'add':
  23.         print("Let's add some numbers")
  24.         input1=input('Number 1 :> ')
  25.         print('')
  26.         input2=input('Number 2 :> ')
  27.         numba1=int(input1)
  28.         numba2=int(input2)
  29.         ansa = numba1+numba2
  30.         ansa=str(ansa)
  31.         print(numba1,'+',numba2,'=',ansa)
  32.     # This is the code for subtracting
  33.     elif command == 'Subtract' or command == 'subtract':
  34.         print("Let's subtract some numbers")
  35.         input1=input('Number 1 :> ')
  36.         print('')
  37.         input2=input('Number 2 :> ')
  38.         numba1=int(input1)
  39.         numba2=int(input2)
  40.         ansa = numba1-numba2
  41.         ansa=str(ansa)
  42.         print(numba1,'-',numba2,'=',ansa)
  43.     # This is new code for calculating the average
  44.     elif command == 'average' or command == 'Average':
  45.         how_many = input('How many numbers? ')
  46.         how_many = int(how_many)
  47.         total = 0
  48.         for counter in range(how_many):
  49.             number = input('Enter number ' + str(counter+1) + '> ')
  50.             total = total + int(number)
  51.         result = total / how_many
  52.         print('The average is',result)
  53.     elif command == 'bye' or command == 'Bye':
  54.         finished = True
  55.         print('Goodbye')
  56.     else:
  57.         print("Sorry! I don't get it!")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top