Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. # Aryan Tomar / DarkTrippin
  2. # habitica.com/challenges/effd2f51-e4b1-4061-94bb-d91dc7a61f55
  3.  
  4. def start():
  5. print ()
  6. print ()
  7. print ()
  8. print (' Aryan T. / DarkTrippin presents ')
  9. print (" The solution for Habitica's Programming challenge July 2019 ")
  10. print (' Python 3 Edition ')
  11. print (' v0.12 ')
  12. print ()
  13. print ('Warning: This is a VERY simple solution for the challenge, very simplified and it is still WIP so no questions please')
  14. print ()
  15. print ()
  16. print ('Please select what type of question you have:')
  17. print ('1. Division')
  18. print ('2. Multiplication')
  19. print ('3. Addition')
  20. print ('4. Subtraction')
  21. print ('5. Quit')
  22. print ()
  23. print ('Please input the the number of your chosen type')
  24. qtype = int(input('> '))
  25. if (qtype >= 1 and qtype <=4):
  26. print ()
  27. print ('Please enter the two numbers from your equation SEPERATELY')
  28. num1 = int (input('> '))
  29. num2 = int (input('> '))
  30. if qtype == 1:
  31. ans = num1/num2
  32. print ('Answer = ' + str(ans))
  33. again()
  34. elif qtype == 2:
  35. ans = num1*num2
  36. print ('Answer = ' + str(ans))
  37. again()
  38. elif qtype == 3:
  39. ans = num1+num2
  40. print ('Answer = ' + str(ans))
  41. again()
  42. elif qtype == 4:
  43. ans = num1-num2
  44. print ('Answer = ' + str(ans))
  45. again()
  46. elif qtype == 5:
  47. exit()
  48. else:
  49. print ('Error: Please input a valid option')
  50.  
  51. def again():
  52. print ()
  53. print ('Do you wish to calculate again? (yes or no)')
  54. startAgain = input('> ')
  55. if startAgain == 'yes' or startAgain == 'y':
  56. start()
  57. else:
  58. startAgain
  59.  
  60. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement