Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Hi, I am Skynet, your AI program.")
- users_name=input("Enter your name please: ")
- finished = False
- while finished == False:
- print("Welcome " + users_name + "!")
- print("Please check below what I can help you with today.")
- 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")
- if command.lower() == "add" or command.lower() == "plus" or command == "+":
- print("Lets add two numbers")
- input1 = input("Input first number: ")
- input2 = input("Input second number: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 + number2
- #print(result)
- total=str(result)
- print(input1 + "+" + input2 + "=" + total)
- elif command.lower() == "subtract" or command.lower() == "minus" or command == "-":
- print("Let's subtract two numbers")
- input1 = input("Input first number: ")
- input2 = input("Input second number: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 - number2
- output = str(result)
- print(input1 + " - " + input2 + " = " + output)
- elif command.lower() == "multiply" or command.lower() == "times" or command == "x" or command == "*":
- print("Let's multiply two numbers")
- input1 = input("Input first number: ")
- input2 = input("Input second number: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 * number2
- output = str(result)
- print(input1 + " * " + input2 + " = " + output)
- elif command.lower() == "divide" or command == "/" or command == "%":
- print("Let's divide two numbers")
- input1 = input("Input first number: ")
- input2 = input("Input second number: ")
- number1 = int(input1)
- number2 = int(input2)
- result = number1 / number2
- output = str(result)
- print(input1 + " / " + input2 + " = " + output)
- elif command.lower() == "average" or command.lower() == "mean":
- print("Let's calculate the average a specific set of numbers")
- how_many = input("How many numbers do you want to calcutae the average for:")
- how_many = int(how_many)
- AverageNumbers = []
- total = 0
- for number_count in range(how_many):
- number = input("Enter number " + str(number_count + 1) + ":")
- AverageNumbers.append(number)
- total = total + int(number)
- result = total / how_many
- print(AverageNumbers)
- print("The average = " + str(result))
- #print("Detailed look would be ()")
- elif command.lower() == "gaming list" or command.lower() == "games" or command.lower() == "gaminglist":
- GamingList = []
- NoOfGames = input("How many games are you planning to buy?")
- if int(NoOfGames) > 5 and int(NoOfGames) <= 10:
- print("Oh my word! That seems too much, right?")
- Confirm = input ("Are you sure you want to buy " + NoOfGames + "?\nPlease enter 'Y' for yes and 'N' for no:")
- if Confirm == "N" or Confirm == "n":
- NewNoOfGames = input ("Please enter new number of games you would like to buy:")
- if int(NewNoOfGames) > int(NoOfGames) and int(NewNoOfGames) <= 10:
- 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")
- NoOfGames = NewNoOfGames
- elif int(NewNoOfGames) == int(NoOfGames):
- print("Well at least you didn't add to your original number of " + NoOfGames)
- elif int(NewNoOfGames) > 10:
- print("No way! I was going to let you increase it to 10, but " + NewNoOfGames + " is out of the question")
- print("You only get 5 now")
- NoOfGames = 5
- else:
- print(NewNoOfGames + " seems more reasonable")
- NoOfGames = NewNoOfGames
- elif Confirm == "Y" or Confirm == "y":
- print("Ok!")
- else:
- print("You didn't enter Y or N, therefore no games for you!")
- NoOfGames = 0
- #print("Good bye!")
- elif int(NoOfGames) > 10:
- print("No way mister!You can only buy 10 max.")
- NoOfGames = 10
- NoOfGames = int(NoOfGames)
- for NoOfGames in range(NoOfGames):
- GameName = input("Please enter game no." + str(NoOfGames +1) + "?")
- GamingList.append(GameName)
- PriceOfGames = []
- print("You have " + str(NoOfGames + 1) + " games in your gaming list")
- PriceTotal = 0
- for Price_Of_Game in range(NoOfGames + 1):
- Price = input("Enter the price of " + GamingList[Price_Of_Game] + ":")
- PriceOfGames.append(Price)
- PriceTotal = PriceTotal + int(Price)
- print(GamingList)
- print(PriceOfGames)
- print("Ok, so your total price will be $" + str(PriceTotal))
- average = PriceTotal / (NoOfGames + 1)
- print("That's an average of $" + str(average) + " per game")
- if (NoOfGames + 1) > 3:
- ask_discount = input("Do you have a discount code?(Y/N):")
- if ask_discount.lower() == 'y':
- discount = input("Please enter the discount code:")
- if discount == "DisCount10":
- print("You get a 10% discount")
- discount_total = PriceTotal * 0.9
- print("Yout new total will be $" + str(discount_total))
- average = discount_total / (NoOfGames + 1)
- print("That's a discounted average of $" + str(average) + " per game")
- elif discount == "DisCount20":
- print("You get a 20% discount")
- discount_total = PriceTotal * 0.8
- print("Yout new total will be $" + str(discount_total))
- average = discount_total / (NoOfGames + 1)
- print("That's a discounted average of $" + str(average) + " per game")
- else:
- print("I am sorry that is not a valid discount code")
- print("Your total is still $" + str(PriceTotal))
- print("That's still an average of $" + str(average) + " per game")
- elif command.lower() == "bye":
- finished = True
- print("Good bye! You can leave now")
- else:
- print("I do not understand, please try again")
- #print("Lets add a thrid number to the result")
- #input3 = input("Input 3rd number: ")
- #number3 = int(input3)
- #third_number_result = result + number3
- #third_number_total = str(third_number_result)
- #print("The addition of the third number " + input3 + " to the previous result " + total + " is equal to " + third_number_total)
- #print("I will also subtract all three numbers in the order you gave me")
- #sub = number1 - number2 - number3
- #sub_total=str(sub)
- #print("The subtraction result of the three numbers respectively is " + sub_total)
- #print("Good bye!")
- #print("Bye!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement