Advertisement
kaly1

Skynet Bot V1.1

Nov 6th, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.34 KB | None | 0 0
  1. print("Hi, I am Skynet, your AI program.")
  2. users_name=input("Enter your name please: ")
  3. finished = False
  4. while finished == False:
  5. print("Welcome " + users_name + "!")
  6. print("Please check below what I can help you with today.")
  7. command = input("Would you like to 'add', 'subtract'\n'multiply', 'divide'\n'average' or create a 'gaming list'?\nOr type in 'Bye' to exit the AI Skynet bot\n")
  8. if command.lower() == "add" or command.lower() == "plus" or command == "+":
  9. print("Lets add two numbers")
  10. input1 = input("Input first number: ")
  11. input2 = input("Input second number: ")
  12. number1 = int(input1)
  13. number2 = int(input2)
  14. result = number1 + number2
  15. #print(result)
  16. total=str(result)
  17. print(input1 + "+" + input2 + "=" + total)
  18. elif command.lower() == "subtract" or command.lower() == "minus" or command == "-":
  19. print("Let's subtract two numbers")
  20. input1 = input("Input first number: ")
  21. input2 = input("Input second number: ")
  22. number1 = int(input1)
  23. number2 = int(input2)
  24. result = number1 - number2
  25. output = str(result)
  26. print(input1 + " - " + input2 + " = " + output)
  27. elif command.lower() == "multiply" or command.lower() == "times" or command == "x" or command == "*":
  28. print("Let's multiply two numbers")
  29. input1 = input("Input first number: ")
  30. input2 = input("Input second number: ")
  31. number1 = int(input1)
  32. number2 = int(input2)
  33. result = number1 * number2
  34. output = str(result)
  35. print(input1 + " * " + input2 + " = " + output)
  36. elif command.lower() == "divide" or command == "/" or command == "%":
  37. print("Let's divide two numbers")
  38. input1 = input("Input first number: ")
  39. input2 = input("Input second number: ")
  40. number1 = int(input1)
  41. number2 = int(input2)
  42. result = number1 / number2
  43. output = str(result)
  44. print(input1 + " / " + input2 + " = " + output)
  45. elif command.lower() == "average" or command.lower() == "mean":
  46. print("Let's calculate the average a specific set of numbers")
  47. how_many = input("How many numbers do you want to calcutae the average for:")
  48. how_many = int(how_many)
  49. AverageNumbers = []
  50. total = 0
  51. for number_count in range(how_many):
  52. number = input("Enter number " + str(number_count + 1) + ":")
  53. AverageNumbers.append(number)
  54. total = total + int(number)
  55. result = total / how_many
  56. print(AverageNumbers)
  57. print("The average = " + str(result))
  58. #print("Detailed look would be ()")
  59. elif command.lower() == "gaming list" or command.lower() == "games" or command.lower() == "gaminglist":
  60. GamingList = []
  61. NoOfGames = input("How many games are you planning to buy?")
  62. if int(NoOfGames) > 5 and int(NoOfGames) <= 10:
  63. print("Oh my word! That seems too much, right?")
  64. Confirm = input ("Are you sure you want to buy " + NoOfGames + "?\nPlease enter 'Y' for yes and 'N' for no:")
  65. if Confirm == "N" or Confirm == "n":
  66. NewNoOfGames = input ("Please enter new number of games you would like to buy:")
  67. if int(NewNoOfGames) > int(NoOfGames) and int(NewNoOfGames) <= 10:
  68. print("Wow! You increased it from " + NoOfGames + " to " + NewNoOfGames + ". Ok, but only if you start learning how to code using Python on your Raspberry Pi")
  69. NoOfGames = NewNoOfGames
  70. elif int(NewNoOfGames) == int(NoOfGames):
  71. print("Well at least you didn't add to your original number of " + NoOfGames)
  72. elif int(NewNoOfGames) > 10:
  73. print("No way! I was going to let you increase it to 10, but " + NewNoOfGames + " is out of the question")
  74. print("You only get 5 now")
  75. NoOfGames = 5
  76. else:
  77. print(NewNoOfGames + " seems more reasonable")
  78. NoOfGames = NewNoOfGames
  79. elif Confirm == "Y" or Confirm == "y":
  80. print("Ok!")
  81. else:
  82. print("You didn't enter Y or N, therefore no games for you!")
  83. NoOfGames = 0
  84. #print("Good bye!")
  85. elif int(NoOfGames) > 10:
  86. print("No way mister!You can only buy 10 max.")
  87. NoOfGames = 10
  88. NoOfGames = int(NoOfGames)
  89. for NoOfGames in range(NoOfGames):
  90. GameName = input("Please enter game no." + str(NoOfGames +1) + "?")
  91. GamingList.append(GameName)
  92.  
  93.  
  94. PriceOfGames = []
  95. print("You have " + str(NoOfGames + 1) + " games in your gaming list")
  96. PriceTotal = 0
  97. for Price_Of_Game in range(NoOfGames + 1):
  98. Price = input("Enter the price of " + GamingList[Price_Of_Game] + ":")
  99. PriceOfGames.append(Price)
  100. PriceTotal = PriceTotal + int(Price)
  101.  
  102. print(GamingList)
  103. print(PriceOfGames)
  104. print("Ok, so your total price will be $" + str(PriceTotal))
  105. average = PriceTotal / (NoOfGames + 1)
  106. print("That's an average of $" + str(average) + " per game")
  107. if (NoOfGames + 1) > 3:
  108. ask_discount = input("Do you have a discount code?(Y/N):")
  109. if ask_discount.lower() == 'y':
  110. discount = input("Please enter the discount code:")
  111. if discount == "DisCount10":
  112. print("You get a 10% discount")
  113. discount_total = PriceTotal * 0.9
  114. print("Yout new total will be $" + str(discount_total))
  115. average = discount_total / (NoOfGames + 1)
  116. print("That's a discounted average of $" + str(average) + " per game")
  117. elif discount == "DisCount20":
  118. print("You get a 20% discount")
  119. discount_total = PriceTotal * 0.8
  120. print("Yout new total will be $" + str(discount_total))
  121. average = discount_total / (NoOfGames + 1)
  122. print("That's a discounted average of $" + str(average) + " per game")
  123. else:
  124. print("I am sorry that is not a valid discount code")
  125. print("Your total is still $" + str(PriceTotal))
  126. print("That's still an average of $" + str(average) + " per game")
  127.  
  128.  
  129.  
  130. elif command.lower() == "bye":
  131. finished = True
  132. print("Good bye! You can leave now")
  133. else:
  134. print("I do not understand, please try again")
  135.  
  136. #print("Lets add a thrid number to the result")
  137. #input3 = input("Input 3rd number: ")
  138. #number3 = int(input3)
  139. #third_number_result = result + number3
  140. #third_number_total = str(third_number_result)
  141. #print("The addition of the third number " + input3 + " to the previous result " + total + " is equal to " + third_number_total)
  142. #print("I will also subtract all three numbers in the order you gave me")
  143. #sub = number1 - number2 - number3
  144. #sub_total=str(sub)
  145. #print("The subtraction result of the three numbers respectively is " + sub_total)
  146.  
  147. #print("Good bye!")
  148.  
  149.  
  150. #print("Bye!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement