Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- intro =("Hi, I am Fidel, your personal boty.")
- print (intro)
- print('Here you can: add(+), subract(-), multiply(x), divide(/) or work out net pay - enter: net or n')
- command = input('How can I help?')
- # The options here are to add [+] or subtract [-] any 2 numbers you input
- if command =='add' or command =='+':
- print('Lets add two numbers')
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1 = int(input1)
- number2 = int(input2)
- result=number1+number2
- output= str(result)
- print(input1 + '+' + input2 + '=' + output)
- elif command =='net' or command =='n':
- print('We will calculate net pay, please input gross pay then tax free allowance')
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1 = float(input1)
- number2 = float(input2)
- if number1 < number2: #gross < tax free allowance = no tax
- output= str(number1)
- print('There are tax deductions so net pay = gross pay= '+ output)
- else:
- taxable=(number1-number2)*0.8
- result=number2+taxable
- output= str(result)
- print('net pay = ' + output)
- elif command =='multiply' or command =='x':
- print('Lets multiply two numbers')
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1 = int(input1)
- number2 = int(input2)
- result=number1*number2
- output= str(result)
- print(input1 + 'x' + input2 + '=' + output)
- elif command =='divide' or command =='/':
- print('Lets divide two numbers')
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1 = float(input1)
- number2 = float(input2)
- result=number1/number2
- output= str(result)
- print(input1 + '/' + input2 + '=' + output)
- elif command =='divide' or command =='/':
- print('Lets divide two numbers')
- input1=input("Number 1 = ")
- input2=input("Number 2 = ")
- number1 = float(input1)
- number2 = float(input2)
- result=number1/number2
- output= str(result)
- print(input1 + '/' + input2 + '=' + output)
- else:
- print('The wrong function was entered') #input error flag
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement