I have an assignment to use the built in debugging tool in the shell but I have no clue how to interpret what is wrong with the code aside from obvious such as the it asks for heads or tails but the flip is a random variant.
Using the file “coinFlipWrong.py” use the debugger and find all the problems. Identify the problem and recommend how to fix. Write up your answer in electronic form (i.e. Word) using this format for each of the problems you find:
here is the code I am supposed to use:
#Coin Flipping game - user guesses heads or tails # (0 = HEADS and 1 = TAILS) import random #variables for game userGuess = "" flipResults = ["tails", "heads"] playGame = 'y' noCorrect = 0 noWrong = 0 while(playGame=='y'): #get the user's guess while userGuess not in flipResults: userGuess = input("Pick heads or tails : ") userGuess = userGuess.lower() #flip the coin flip = random.randint(0,1) #see if user is correct if(flipResults == userGuess): print("You guessed it!") noCorrect = noCorrect + 1 else: print("Sorry you did not guess correctly") noWrong = noWrong + 1 print("Thank you for playing !!!") print("You guessed " + str(noCorrect) + " Correctly.") print("You guessed " + str(noWrong) + " Incorrectly.")