This is my code:
import time,sys,random
wpm = 125
userName = ""
global mirror
mirror = False
global knife
knife = False
inventory = []
vial = False
trollHit = 0
playerHit = 0
axe = False
choice2 = False
kitchenAlready = False
def death():
sys.exit()
userInput = ""
def cantPerformAction(userInput):
if userInput == "e" or userInput == "u" or userInput == "w" or userInput == "s" or "t" in userInput:
slow_type("You can't perform that action.")
def checkDirection(userInput):
if any(char in userInput for char in 'nsewudt') == False:
return False
elif any(char in userInput for char in 'nsewudt') == True:
return True
#credit to 'bill gross' for ideas on the slow type
def slow_type(y): #slow typing to make it seem like the computer is typing
for x in y:
sys.stdout.write(x)
sys.stdout.flush()
time.sleep(random.random( )*10.0/wpm)
print (' ')
def clear(): #clear the line so that another line of text can appear below it
print ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
#CROSSROADS: All directions lead to death except right. Player cannot turn back.
def crossroads():
slow_type("\n\nCrossroads")
slow_type("\n\nA crossroads is in front of you. There is a passage to the west, east, and north.")
global choice2
global choice
choice = None
choice2 = None
youBetterChoose = 0
while choice == None and choice2 == None:
userInput = input("\n>")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input("\n>")
checkDirection(userInput)
userInput1 = userInput.lower().strip()
if userInput1 == "s":
clearingalready()
if userInput1 =="n":
slow_type("\n>You walk forward, determined... off a cliff. Tragic!")
death()
if userInput1 == "w":
slow_type("\nYou encounter a giant spider. Without a weapon, it easily tears you to shreds.")
death()
if userInput1 == "e":
fork()
if userInput1 == "d":
slow_type("You can't do down farther than the floor.")
if userInput1 == "u":
slow_type("You can't go that way.")
userInput = ""
def crossroadsalready():
slow_type("\n\nCrossroads")
global choice2
global choice
choice = None
choice2 = None
youBetterChoose = 0
while choice == None and choice2 == None:
userInput = input("\n>")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input("\n>")
checkDirection(userInput)
userInput1 = userInput.lower().strip()
if userInput1 == "s":
clearingalready()
if userInput1 =="n":
slow_type("\n>You walk forward, determined... off a cliff. Tragic!")
death()
if userInput1 == "w":
slow_type("\nYou encounter a giant spider. Without a weapon, it easily tears you to shreds.")
death()
if userInput1 == "e":
fork()
if userInput1 == "d":
slow_type("You can't do down farther than the floor.")
if userInput1 == "u":
slow_type("You can't go that way.")
userInput = ""
def fork():
choice2 = False
slow_type("\nFork")
slow_type("\nThere are another two ways to go. One goes north into a cavern, another leads down deeper into the earth.\n\n")
deeperOrFarther = ""
while choice2 == False:
userInput = input(">")
checkDirection(userInput)
if checkDirection(userInput) == False:
while checkDirection(userInput) == False:
userInput = input (">")
checkDirection(userInput)
deepLower = userInput.lower().strip()
if deepLower == "n":
slow_type("You walk forward, determined... off a cliff. Tragic!")
choice2 = True
death()
if deepLower == "d":
slow_type("You descend down into the darker regions of the cave.")
choice2 = True
if deepLower == "w":
crossroadsalready()
cantPerformAction(deepLower)
houseChoice()
wpm = 60
slow_type("Welcome to Zotan! \nn = north \ns = south \nw = west \ne = east \nu = up \nd = down \nt = take")
clear()
wpm = 120
def clearing():
slow_type("Clearing\n")
slow_type("You wake up in the middle of a clearing. There is a passage to the north.")
slow_type("\n\n")
clearingalready = True
choice = None
while choice == None:
userInput = input("\n>")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input("\n>")
checkDirection(userInput)
userInput = userInput.lower()
if userInput.strip() == "n":
choice = False
else:
slow_type("You can't go that way.")
userInput = ""
crossroads() #1
def clearingalready():
slow_type("Clearing\n")
slow_type("There is a passage to the north.")
slow_type("\n\n")
choice = None
while choice == None:
userInput = input("\n>")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input("\n>")
checkDirection(userInput)
userInput = userInput.lower()
if userInput.strip() == "n":
choice = False
else:
slow_type("You can't go that way.")
userInput = ""
crossroads() #1
def houseChoice():
slow_type("\n\n\n\nHouse Doorway\n\n")
choice = None
while choice == None:
userInput = input(">")
checkDirection(userInput)
if checkDirection(userInput) == False:
while checkDirection(userInput) == False:
userInput = input(">")
checkDirection(userInput)
userInput = userInput.lower().strip()
if userInput == "d" or userInput == "u" or userInput == "w" or userInput == "e":
slow_type("You can't go that way.")
if userInput == "n":
choice = False
if userInput == "s":
choice = False
if userInput == "s":
fork()
elif userInput == "n":
entryway()
def entryway():
slow_type("\nEntryway")
slow_type("\n\nThere is a kitchen to the west and a dark staircase. A back door hangs open in the north, revealing the entry into another dark corridor.")
userInput = input("\n>")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input("\n>")
checkDirection(userInput)
userInput = userInput.lower().strip()
if userInput == "w":
kitchen()
if userInput == "u":
attic()
if userInput == "n":
chasm()#4
if userInput == "s":
houseChoice()
def entrywayalready():
slow_type("\nEntryway")
userInput = input("\n>")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input("\n>")
checkDirection(userInput)
userInput = userInput.lower().strip()
if userInput == "w":
if kitchenAlready == False:
kitchen()
elif kitchenAlready == True:
kitchenalready()
if userInput == "u":
attic()
if userInput == "n":
chasm()#4
def kitchen():
kitchenAlready = True
slow_type("\n\nKitchen")
slow_type("It seems that the kitchen has been used recently. There is a wicked looking steak knife on the counter, and a mirror on the table.")
userInput = input("\n>")
userInput = userInput.lower().strip()
if userInput == "t knife":
if "knife" not in inventory:
slow_type("Taken.")
inventory.append("knife")
elif "knife" in inventory:
slow_type("You can't take that item.")
elif userInput == "t mirror":
if "mirror" not in inventory:
inventory.append("mirror")
elif "mirror" in inventory:
slow_type("You can't take that item.")
slow_type("You can't perform that action.")
elif userInput == "e":
entrywayalready()
def kitchenalready():
slow_type("\n\nKitchen")
userInput = input("\n>")
userInput = userInput.lower().strip()
if "knife" not in inventory:
inventory.append("knife")
elif "knife" in inventory:
slow_type("You can't take that item.")
if userInput == "t mirror":
if "mirror" not in inventory:
inventory.append("mirror")
elif "mirror" in inventory:
slow_type("You can't take that item.")
if userInput == "e":
entrywayalready()
def attic():
slow_type("\n\nAttic")
choice = None
while choice == None:
userInput = input(">")
if checkDirection(userInput) == False:
while checkDirection == False:
userInput = input(">")
checkDirection(userInput)
userInput = userInput.lower().strip()
if userInput == "n" or userInput == "s" or userInput == "e" or userInput == "w" or userInput == "u":
slow_type("You can't go that way")
if userInput == "t vial":
if "vial" not in inventory:
slow_type("Taken.")
inventory.append("vial")
elif "vial" in inventory:
slow_type("You can't take that item.")
if userInput == "d":
choice = False
entryway()#6
def chasm():
slow_type("\n\nChasm")
slow_type("\nThere is a chasm in front of you, with a rickety wooden bridge crossing the wide and endlessly deep ravine to the north, and a small passage to the west.")
userInput = input(">")
checkDirection(userInput)
if checkDirection(userInput) == False:
while checkDirection(userInput) == False:
userInput = input (">")
checkDirection(userInput)
chasmChoice = userInput.lower().strip()
if chasmChoice == "n":
slow_type("You cross the wooden bridge and it crumbles behind you. There is no turning back.")
cavern()
if chasmChoice == "w":
smallPassage()
if chasmChoice == "s":
entryway()#7
def smallPassage():
slow_type("\n\nSmall Passage")
slow_type("\nThere is a room to the west.")
userInput = input(">")
checkDirection(userInput)
if checkDirection(userInput) == False:
while checkDirection(userInput) == False:
userInput = input (">")
checkDirection(userInput)
userInputLower = userInput.lower().strip()
if userInputLower == "w":
trollRoom()
if userInputLower == "e":
chasm()
if userInputLower == "s" or userInputLower == "n" or userInputLower == "u" or userInputLower == "d" or userInputLower == "t":
slow_type("You can't perform that action.")#8
def trollRoom():
slow_type("\n\nTroll Room")
slow_type("\nThere is a troll in the room with a large blood stained axe.")
lowerr = "l"
while lowerr != "e":
userInput = input(">")
lowerr = userInput.lower().strip()
if lowerr == "attack troll":
if "knife" in inventory:
xRan = random.randint(0,3)
if xRan == "3":
slow_type("The troll parries your attack.")
if xRan == "2":
slow_type("You get a clear hit on the troll. It groans loudly, displaying a look of deep hatred on it's deformed face.")
trollHit = trollHit + 1
if trollHit == 2:
slow_type("The troll falls to the floor, dead. Its axe lays on the floor.")
axe = True
if userInput != "t axe" or userInput != "e":
slow_type("You can't perform that action.")
if xRan == 3:
if playerHit == 0:
slow_type("The troll knocks you back.")
if playerHit == 1:
slow_type("The troll lands a clean graze on your shoulder. You cry out in pain.")
if lowerr == "t axe":
if axe == True:
slow_type("Taken.")
inventory.append("axe")
elif axe != True:
slow_type("There is no axe there.")
if lowerr == "n" or lowerr == "s" or lowerr == "d" or lowerr == "u" or lowerr == "t" or lowerr == "w":
slow_type("You cannot perform that action.")#9
clearingAlready = False #Determines whether or not the player has already been to the crossroads.
clearing()
crossroads()
fork()
When I execute this particular part of the code It seems like there is no ouput from the computer, no Taken. or You can't perform that action. I can't seem to pinpoint the exact cause of the error or why it is misbehaving.
Console output:
House Doorway
>n
Entryway
>w
Kitchen
>t knife
output: nothing
Related
File "E:\P-L\Atom\RPS.py\RPS.py", line 34
if user_choice == "r":
IndentationError: unexpected indent
i'm new to code and i'm making a project
someone said the you learn better by doing projects
so here i am
i'm getting this on Atom
i've tried the same code on repl.it and it works
import random
comp_wins = 0
player_wins = 0
def Choose_Option():
user_choice = input("Choose Rock, Paper or Scissors: ")
if user_choice in ["Rock", "rock", "r", "R"]:
user_choice = "r"
elif user_choice in ["Paper", "paper", "p", "P"]:
user_choice = "p"
elif user_choice in ["Scissors", "scissors", "s", "S"]:
user_choice = "s"
else:
print("I don't understand, try again.")
Choose_Option()
return user_choice
def Computer_Option():
comp_choice = random.randint(1, 3)
if comp_choice == 1:
comp_choice = "r"
elif comp_choice == 2:
comp_choice = "p"
else:
comp_choice = "s"
return comp_choice
while True:
print("")
user_choice = Choose_Option()
comp_choice = Computer_Option()
print("")
if user_choice == "r":
if comp_choice == "r":
print("You chose rock. The computer chose rock. You tied.")
elif comp_choice == "p":
print("You chose rock. The computer chose paper. You lose.")
comp_wins += 1
elif comp_choice == "s":
print("You chose rock. The computer chose scissors. You win.")
player_wins += 1
elif user_choice == "p":
if comp_choice == "r":
print("You chose paper. The computer chose rock. You win.")
player_wins += 1
elif comp_choice == "p":
print("You chose paper. The computer chose paper. You tied.")
elif comp_choice == "s":
print("You chose paper. The computer chose scissors. You lose.")
comp_wins += 1
elif user_choice == "s":
if comp_choice == "r":
print("You chose scissors. The computer chose rock. You lose.")
comp_wins += 1
elif comp_choice == "p":
print("You chose scissors. The computer chose paper. You win.")
player_wins += 1
elif comp_choice == "s":
print("You chose scissors. The computer chose scissors. You tied.")
print("")
print("Player wins: " + str(player_wins))
print("Computer wins: " + str(comp_wins))
print("")
user_choice = input("Do you want to play again? (y/n)")
if user_choice in ["Y", "y", "yes", "Yes"]:
pass
elif user_choice in ["N", "n", "no", "No"]:
break
else:
break
Pretty sure the problem is with atom but i don't know what it is would love any help.
I am not sure as to why but for the if statements it does not correctly print the messages. Whenever I run the program it only runs the else statement but not the rest of the if statements
import random
import sys
def main():
while True:
aimove = random.randint(1, 3)
print("|//////////////|")
print("| 1 - Rock |")
print("| 2 - Paper |")
print("| 3 - Scissors |")
print("|//////////////|")
usermove = input("Choose your move")
# decides who wins or loses
if aimove == "1" and usermove == "2":
print("you won!")
elif aimove == "1" and usermove == "1":
print("you tied")
elif aimove == "1" and usermove == "3":
print("you lost")
elif aimove == "2" and usermove == "3":
print("you won!")
elif aimove == "2" and usermove == "2":
print("you tied")
elif aimove == "2" and usermove == "1":
print("you lost")
elif aimove == "3" and usermove == "1":
print("you won!")
elif aimove == "3" and usermove == "3":
print("you tied")
elif aimove == "3" and usermove == "1":
print("you lost")
else:
sys.exit()
# Print messages of match
print("User aimove: " + str(usermove))
print("Opponent aimove: " + str(aimove))
main()
random.randint gives an integer, not a string. so, if you compare string with int, it'll never be the same.
You can remove quotes around every number like Russ J said in comments, or, you can just convert that into str()
import random
import sys
def main():
while True:
aimove = str(random.randint(1, 3))
print("|//////////////|")
print("| 1 - Rock |")
print("| 2 - Paper |")
print("| 3 - Scissors |")
print("|//////////////|")
usermove = input("Choose your move")
# decides who wins or loses
if aimove == "1" and usermove == "2":
print("you won!")
elif aimove == "1" and usermove == "1":
print("you tied")
elif aimove == "1" and usermove == "3":
print("you lost")
elif aimove == "2" and usermove == "3":
print("you won!")
elif aimove == "2" and usermove == "2":
print("you tied")
elif aimove == "2" and usermove == "1":
print("you lost")
elif aimove == "3" and usermove == "1":
print("you won!")
elif aimove == "3" and usermove == "3":
print("you tied")
elif aimove == "3" and usermove == "1":
print("you lost")
else:
sys.exit()
# Print messages of match
print("User aimove: " + str(usermove))
print("Opponent aimove: " + str(aimove))
main()
Here is your error:
elif aimove == "3" and usermove == "1":
print("you won!")
elif aimove == "3" and usermove == "3":
print("you tied")
elif aimove == "3" and usermove == "1":
print("you lost")
3 and 1 combination is for both - won and lost
Also I discovered your error when coding as below:
dct = dict()
dct["12"] = "you won!"
dct["11"] = "you tied!"
dct["13"] = "you lost!"
dct["23"] = "you won!"
dct["22"] = "you tied!"
dct["21"] = "you lost!"
dct["31"] = "you won!"
dct["33"] = "you tied!"
dct["32"] = "you lost!"
# OR
#dct = {'12': 'you won!', '11': 'you tied!', '13': 'you lost!', '23': 'you won!', '22': 'you tied!', '21': 'you lost!', '31': 'you won!', '33': 'you tied!', '32': 'you lost!'}
if dct.get(aimove+usermove)
print(dct[aimove+usermove])
else:
sys.exit()
So replace your corresponding code and get rid of all elifs
I am trying to create a program that lets the user choose to play rock, paper or scissors. Once they choose what they want to play and the amount of games that they want to play, they will be told if they won or lost.
I want to tally up the amount of times they won or lost, but instead it just prints after each round. Is there a way that I can make it print after the game is completed? I want to show the user the outcome overall at the end
from random import randint
def main():
games = int(input("How many games would you like to play?"))
while games > 0:
games -= 1
comp = computer()
choice = user()
print("You played", choice, "and the computer played", comp)
winner(comp, choice)
def computer():
comp = randint in range (0,3)
if comp == 0:
comp = 'rock'
elif comp == 1:
comp = 'paper'
elif comp == 2:
comp = 'scissors'
return comp
def user():
choice = int(input("choose 0 for rock, 1 for paper, or 2 for scissors: "))
if choice == 0:
choice = 'rock'
elif choice == 1:
choice = 'paper'
elif choice == 2:
choice = 'scissors'
else:
print("invalid input")
return choice
def winner(comp, choice):
tie = 0
win = 0
lose = 0
while True:
if choice == "rock" and comp == "rock":
result = 'tie'
tie += 1
break
elif choice == 'rock'and comp == 'scissors':
result = "you win"
win += 1
break
elif choice == 'rock' and comp == 'paper':
result = "you lose"
lose += 1
break
elif choice == 'paper' and comp == 'paper':
result = 'tie'
tie += 1
break
elif choice == 'paper' and comp == 'scissors':
result = 'you lose'
lose += 1
break
elif choice == 'paper' and comp == 'rock':
result = 'you win'
win =+ 1
break
elif choice == 'scissors' and comp == 'scissors':
result = 'tie'
tie += 1
break
elif choice == 'scissors' and comp == 'paper':
result = 'you win'
win += 1
break
elif choice == 'scissors' and comp == 'rock':
result = 'you lose'
lose +=1
break
else:
print("error")
break
print(result)
print("you won", win,"times, and lost", lose,"times, and tied", tie,"times.")
main()
Declare globals for the win, lose and tie counters
randint(0, 2) is how you get random integer
It's += and not =+
There are couple of mistakes. I added a comment # CORRECTION at the respective lines.
from random import randint
tie = 0
win = 0
lose = 0
def main():
games = int(input("How many games would you like to play?"))
while games > 0:
games -= 1
comp = computer()
choice = user()
print("You played", choice, "and the computer played", comp)
winner(comp, choice)
def computer():
# CORRECTION: randint in range (0,3) always return FALSE. BELOW IS THE CORRECT WAY
comp = randint(0, 2)
if comp == 0:
comp = 'rock'
elif comp == 1:
comp = 'paper'
elif comp == 2:
comp = 'scissors'
return comp
def user():
choice = int(input("choose 0 for rock, 1 for paper, or 2 for scissors: "))
if choice == 0:
choice = 'rock'
elif choice == 1:
choice = 'paper'
elif choice == 2:
choice = 'scissors'
else:
print("invalid input")
return choice
def winner(comp, choice):
# CORRECTION: MAKE ALL THE COUNTERS GLOBAL
global tie
global win
global lose
while True:
if choice == "rock" and comp == "rock":
result = 'tie'
tie += 1
break
elif choice == 'rock'and comp == 'scissors':
result = "you win"
win += 1
break
elif choice == 'rock' and comp == 'paper':
result = "you lose"
lose += 1
break
elif choice == 'paper' and comp == 'paper':
result = 'tie'
tie += 1
break
elif choice == 'paper' and comp == 'scissors':
result = 'you lose'
lose += 1
break
elif choice == 'paper' and comp == 'rock':
result = 'you win'
# CORRECTION: ITS NOT =+ ITS +=
# win =+ 1
win += 1
break
elif choice == 'scissors' and comp == 'scissors':
result = 'tie'
tie += 1
break
elif choice == 'scissors' and comp == 'paper':
result = 'you win'
win += 1
break
elif choice == 'scissors' and comp == 'rock':
result = 'you lose'
lose +=1
break
else:
print("error")
break
print(result)
main()
print("you won", win,"times, and lost", lose,"times, and tied", tie,"times.")
My program is continually looping and I would like to figure out why before I progress any further into the project it self. The programs purpose is to create a key from the alphabet that is used to decode/encode a message.
import random
def main():
userselection = "0"
print("This program allows you to create keys, econde plaintext, and decode ciphertext.")
while userselection != "4":
print("What would you like to do?")
userselection = input("1.create a key 2.encode a message 3.decode a message 4.quit > ")
if userselection == "1":
#selection 1 stuffs goes here
alphabet = "abcdefghijklmnopqrstuvwxyz"
key = ""
letter = random.choice(alphabet)
elif userselection == "2":
#selection 2 stuffs
plaintext = plaintext.lower()
ciphertext = ""
for i in range(len(plaintext)):
alphabetposition = alphabet.find(plaintext[i])
if alphabetposition >= 0:
ciphertext = ciphertext + key[alphabetposition]
else:
ciphertext = cipertext + plaintext[i]
elif userselection == "3":
#selection 3 stuffs
print()
elif userselection != "4":
print("invalid selection")
if __name__ == "__main__":
main()
I think you need to take user input inside the while loop. Try this :-
import random
def main():
userselection = "0"
print("This program allows you to create keys, econde plaintext, and decode ciphertext.")
while userselection != "4":
print("What would you like to do?")
userselection = input("1.create a key 2.encode a message 3.decode a message 4.quit > ")
if userselection == "1":
#selection 1 stuffs goes here
alphabet = "abcdefghijklmnopqrstuvwxyz"
key = ""
letter = random.choice(alphabet)
elif userselection == "2":
#selection 2 stuffs
plaintext = plaintext.lower()
ciphertext = ""
for i in range(len(plaintext)):
alphabetposition = alphabet.find(plaintext[i])
if alphabetposition >= 0:
ciphertext = ciphertext + key[alphabetposition]
else:
ciphertext = cipertext + plaintext[i]
elif userselection == "3":
#selection 3 stuffs
print()
elif userselection != "4":
print("invalid selection")
if __name__ == "__main__":
main()
While loop at wrong position. It looping as you set userselection = "0" after that before user input you checking the
while userselection != "4":
print("What would you like to do?")
I will suggest you should comments this lines and take rerun.
I had previously asked about why my counter wasn't working. So, whilst working a different project, I realised I needed a counter but couldn't find or place one that fitted my needs. (I am also well aware that this could be shortened but ignore that). The counter needs to allow only 10 questions to be asked, but I just couldn't figure out how to adapt the others that I saw.
from random import randint
import random
import math
count = 0
print("This game is a quiz to see how good you are at maths. No paper allowed!")
def Start():
print("No paper allowed nor a calculator!")
ans1 = input("Do you wish to start? \n")
if ans1 == "Yes" or ans1 == "yes" or ans1 == "Y" or ans1 == "y":
Begin(count)
if ans1 == "no" or ans1 == "No" or ans1 == "n" or ans1 == "N":
exit()
def Begin(count):
opers = ['+','-','*',"/"]
operation = random.choice(opers)
num1 = random.randint(2,21)
num2 = random.randint(2,num1)
num3 = int(eval(str(num1) + operation + str(num2)))
ans2 = int(input("What is "+str(num1) + operation + str(num2)+"? \n"))
if ans2 == num3:
print("Well done! You must be good at maths!")
Begin(count)
if ans2 != num3:
print("You are terrible at maths. Go sit in that corner. (The answer was "+str(num3)+").")
Begin(count)
def Replay():
ans3 = input("Would you like to play again? \n")
if ans3 == "Yes" or ans3 == "yes" or ans3 == "Y" or ans3 == "y":
Start()
if ans3 == "no" or ans3 == "No" or ans3 == "n" or ans3 == "N":
exit()
Start()
in Begin function add :
global counter
counter+=1
if counter == 10:
print("something...")
EDIT:
this works!
from random import randint
import random
import math
count = 0
print("This game is a quiz to see how good you are at maths. No paper allowed!")
def Start():
print("No paper allowed nor a calculator!")
ans1 = input("Do you wish to start? \n")
if ans1 == "Yes" or ans1 == "yes" or ans1 == "Y" or ans1 == "y":
Begin()
if ans1 == "no" or ans1 == "No" or ans1 == "n" or ans1 == "N":
exit()
def Begin():
global count
count+=1
if count==10:
print("finished")
exit()
opers = ['+', '-', '*', "/"]
operation = random.choice(opers)
num1 = random.randint(2
, 21)
num2 = random.randint(2, num1)
num3 = int(eval(str(num1) + operation + str(num2)))
ans2 = int(input("What is " + str(num1) + operation + str(num2) + "? \n"))
if ans2 == num3:
print("Well done! You must be good at maths!")
Begin()
if ans2 != num3:
print("You are terrible at maths. Go sit in that corner. (The answer was " + str(num3) + ").")
Begin()
def Replay():
ans3 = input("Would you like to play again? \n")
if ans3 == "Yes" or ans3 == "yes" or ans3 == "Y" or ans3 == "y":
Start()
if ans3 == "no" or ans3 == "No" or ans3 == "n" or ans3 == "N":
exit()
Start()