Advertisement
Mickyq

Untitled

Dec 12th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. intro =("Hi, I am Fidel, your personal boty.")
  2. print (intro)
  3. print('Here you can: add(+), subract(-), multiply(x), divide(/) or work out net pay - enter: net or n')
  4. command = input('How can I help?')
  5. # The options here are to add [+] or subtract [-] any 2 numbers you input
  6. if command =='add' or command =='+':
  7. print('Lets add two numbers')
  8. input1=input("Number 1 = ")
  9. input2=input("Number 2 = ")
  10. number1 = int(input1)
  11. number2 = int(input2)
  12. result=number1+number2
  13. output= str(result)
  14. print(input1 + '+' + input2 + '=' + output)
  15. elif command =='net' or command =='n':
  16. print('We will calculate net pay, please input gross pay then tax free allowance')
  17. input1=input("Number 1 = ")
  18. input2=input("Number 2 = ")
  19. number1 = float(input1)
  20. number2 = float(input2)
  21. if number1 < number2: #gross < tax free allowance = no tax
  22. output= str(number1)
  23. print('There are tax deductions so net pay = gross pay= '+ output)
  24. else:
  25. taxable=(number1-number2)*0.8
  26. result=number2+taxable
  27. output= str(result)
  28. print('net pay = ' + output)
  29. elif command =='multiply' or command =='x':
  30. print('Lets multiply two numbers')
  31. input1=input("Number 1 = ")
  32. input2=input("Number 2 = ")
  33. number1 = int(input1)
  34. number2 = int(input2)
  35. result=number1*number2
  36. output= str(result)
  37. print(input1 + 'x' + input2 + '=' + output)
  38. elif command =='divide' or command =='/':
  39. print('Lets divide two numbers')
  40. input1=input("Number 1 = ")
  41. input2=input("Number 2 = ")
  42. number1 = float(input1)
  43. number2 = float(input2)
  44. result=number1/number2
  45. output= str(result)
  46. print(input1 + '/' + input2 + '=' + output)
  47. elif command =='divide' or command =='/':
  48. print('Lets divide two numbers')
  49. input1=input("Number 1 = ")
  50. input2=input("Number 2 = ")
  51. number1 = float(input1)
  52. number2 = float(input2)
  53. result=number1/number2
  54. output= str(result)
  55. print(input1 + '/' + input2 + '=' + output)
  56. else:
  57. print('The wrong function was entered') #input error flag
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement