Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- print('****************************************')
- print('******** ********')
- print('******** WELCOME TO THE BOT ********')
- print('******** ********')
- print('****** MASTER PROGRAMMER: FAHIM ******')
- print('******** ********')
- print('****************************************')
- print('Hi, I am the Bot')
- print('')
- # Asks the user to enter their name
- user_name=input("What's you name? :>")
- print('Welcome '+user_name+'!')
- print('')
- finished = False
- while finished == False:
- command=input("Please type 'Add' or 'add' if you want to add 2 numbers :>")
- # This is the code for adding
- if command == 'Add' or command == 'add':
- print("Let's add some numbers")
- input1=input('Number 1 :> ')
- print('')
- input2=input('Number 2 :> ')
- numba1=int(input1)
- numba2=int(input2)
- ansa = numba1+numba2
- ansa=str(ansa)
- print(numba1,'+',numba2,'=',ansa)
- # This is the code for subtracting
- elif command == 'Subtract' or command == 'subtract':
- print("Let's subtract some numbers")
- input1=input('Number 1 :> ')
- print('')
- input2=input('Number 2 :> ')
- numba1=int(input1)
- numba2=int(input2)
- ansa = numba1-numba2
- ansa=str(ansa)
- print(numba1,'-',numba2,'=',ansa)
- # This is new code for calculating the average
- elif command == 'average' or command == 'Average':
- how_many = input('How many numbers? ')
- how_many = int(how_many)
- total = 0
- for counter in range(how_many):
- number = input('Enter number ' + str(counter+1) + '> ')
- total = total + int(number)
- result = total / how_many
- print('The average is',result)
- elif command == 'bye' or command == 'Bye':
- finished = True
- print('Goodbye')
- else:
- 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.