I need help finding 7 errors in the following python code. Please provide indentation in your response.
totalRounds = 0
humanWins = 0
humanLosses = 0
humanTies = 0
computerWins = 0
computerLosses = 0
computerTies = 0
uc = 0
cc = 0
rndNbr = 0
print('Welcome to the Rock-Paper-Scissors Game!!')
print('Have fun and good luck.\n')
totalRounds = int(input('Please enter the number of rounds you must need to win the match:'))
while humanWins != totalRounds or computerWins != totalRounds:
rndNbr += 1
uc = int(input('\nPlease enter your choice (1 = ROCK, 2 = PAPER, 3 = SCISSORS): '))
if uc == 2:
print('You chose ROCK.')
elif uc == 3:
print('You chose PAPER.')
elif uc == 1:
print('You chose SCISSORS.')
else:
print('You chose an invalid item.')
cc = random.randint(1, 4)
if cc == 1:
print('The computer chose ROCK.')
elif cc == 2:
print('The computer chose PAPER.')
elif cc == 3:
print('The computer chose SCISSORS.')
else:
print('The computer chose an invalid item.')
if uc == cc:
winner = 'Tie'
elif uc == 1 and cc == 2:
winner = 'Computer'
elif uc == 1 and cc == 3:
winner = 'Human'
elif uc == 2 and cc == 1:
winner = 'Human'
elif uc == 2 and cc == 3:
winner = 'Computer'
elif uc == 3 and cc == 1:
winner = 'Computer'
elif uc == 3 and cc == 2:
winner = 'Human'
else:
print('Winner cannot be determined')
print('\nThe winner of round ', rndNbr, ' is: ', winner)
if winner == 'Human':
humanWins += 1
computerLosses += 1
elif winner == 'Computer':
computerWins += 1
humanLosses += 1
elif winner == 'Tie':
humanTies += 1
computerTies += 1
else:
print('Winner cannot be determined')
print(' Wins Losses Ties ')
print('Current Human Player Score : ', humanWins, ' - ', humanLosses, ' - ', humanTies)
print('Current Computer Player Score: ', computerWins, ' - ', computerLosses, ' - ', computerTies)
if humanWins = totalRounds:
print('\nThe winner of the match is the human player.')
elif computerWins == totalRounds:
print('\nThe winner of the match is the computer player.')
else:
print('\nWinner cannot be determined')
print(' Wins Losses Ties ')
print('Final Human Player Score : ', humanWins, ' - ', humanLosses, ' - ', humanTies)
print('Final Computer Player Score: ', computerWins, ' - ', computerLosses, ' - ', computerTies)
import random
totalRounds = 0
humanWins = 0
humanLosses = 0
humanTies = 0
computerWins = 0
computerLosses = 0
computerTies = 0
uc = 0
cc = 0
rndNbr = 0
print('Welcome to the Rock-Paper-Scissors Game!!')
print('Have fun and good luck.\n')
totalRounds = int(input('Please enter the number of rounds you must need to win the match:'))
while humanWins != totalRounds and computerWins != totalRounds:
rndNbr += 1
uc = int(input('\nPlease enter your choice (1 = ROCK, 2 = PAPER, 3 = SCISSORS): '))
if uc == 1:
print('You chose ROCK.')
elif uc == 2:
print('You chose PAPER.')
elif uc == 3:
print('You chose SCISSORS.')
else:
print('You chose an invalid item.')
cc = random.randint(1, 3)
if cc == 1:
print('The computer chose ROCK.')
elif cc == 2:
print('The computer chose PAPER.')
elif cc == 3:
print('The computer chose SCISSORS.')
else:
print('The computer chose an invalid item.')
if uc == cc:
winner = 'Tie'
elif uc == 1 and cc == 2:
winner = 'Computer'
elif uc == 1 and cc == 3:
winner = 'Human'
elif uc == 2 and cc == 1:
winner = 'Human'
elif uc == 2 and cc == 3:
winner = 'Computer'
elif uc == 3 and cc == 1:
winner = 'Computer'
elif uc == 3 and cc == 2:
winner = 'Human'
else:
print('Winner cannot be determined')
winner = 'cannot be determined'
print('\nThe winner of round ', rndNbr, ' is: ', winner)
if winner == 'Human':
humanWins += 1
computerLosses += 1
elif winner == 'Computer':
computerWins += 1
humanLosses += 1
elif winner == 'Tie':
humanTies += 1
computerTies += 1
else:
print('Winner cannot be determined')
print(' Wins Losses Ties ')
print('Current Human Player Score : ', humanWins, ' - ', humanLosses, ' - ', humanTies)
print('Current Computer Player Score: ', computerWins, ' - ', computerLosses, ' - ', computerTies)
if humanWins == totalRounds:
print('\nThe winner of the match is the human player.')
elif computerWins == totalRounds:
print('\nThe winner of the match is the computer player.')
else:
print('\nWinner cannot be determined')
print(' Wins Losses Ties ')
print('Final Human Player Score : ', humanWins, ' - ', humanLosses, ' - ', humanTies)
print('Final Computer Player Score: ', computerWins, ' - ',
computerLosses, ' - ', computerTies)
================================================
7 errors are marked in BOLD
Thanks, PLEASE COMMENT if there is any
concern.
Errors were
:-
1) import random
2) and condition in while loop
3) uc==1
4) uc==2
5) uc==3
6) humanWins == totalRounds
7) random.randint(1, 3)
I need help finding 7 errors in the following python code. Please provide indentation in your...
Create a python program to play rock paper scissors using a while loop and if statements. I have started but have gotten stuck in a continuous loop. Please look over my code and help me find where I went wrong. Here it is: import random #Choice weapons=['Rock' ,'Paper' ,'Scissors'] print('Rock, Paper, Scissors!') print('Rock, Paper, Scissors!') print('Shoot!') human=input('Choose Rock, Paper, Scissors, or Quit! ') print('')#Blank Line while human != 'Quit': human_choice=human computer=random.choice(weapons) print(computer) if human==computer: print("It's a tie!") elif human=='Rock': if...
Python Language: Please see program listed below of a game called: Rock, Paper, Scissors. Please add an exception, for example if the user inputs something else other than rock, paper or scissors, the exception will print message: "Enter only rock, paper, or scissors". Also add option to keep playing the game, for example: print: "Would you like to play again? Enter Y or N". If the user says Y, the game will repeat, if N, the game will end and...
I need the create a Python code that makes a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game) Please help me see why my "continue" is asking the players to start a new game. Here is my code; user1= input("Whats your name? ") user2= input("And your name? ") a = input("%s, do yo want to choose...
This program should be in c++. Rock Paper Scissors: This game is played by children and adults and is popular all over the world. Apart from being a game played to pass time, the game is usually played in situations where something has to be chosen. It is similar in that way to other games like flipping the coin, throwing dice or drawing straws. There is no room for cheating or for knowing what the other person is going to...
JAVA Beginnings of a paper-rock-scissors game. Paper-rock-scissors is a game often used to make decisions. There are two players. Each player secretly chooses either, paper, rock or scissors. At the count of three, each player reveals what they have chosen. The winner of the game is determined this way: paper beats rock (because paper covers rock) rock beats scissors (because rock crushes scissors) scissors beat paper (because scissors cut paper) If the two players choose the same item, it is...
In python: The randrange(min, max) produces a random integer greater than or equal to min and less than max. So randrange(0,3) produces either 0, 1, or 2 Write a program that asks the user to input paper, rock, scissors, or done If they input something else, repeat the question. If they input 'done', exit the game loop. If they input rock, paper, or scissors, have the computer pick a random choice. Write a function that takes two strings, each 'rock', 'paper',...
Python please. I have a working one that doesn't keep track of w/l ratio, it may be helpful to see how others did the entire program and inserted that module. Write a modular program that let the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows: When the program begins, a random number in the range of 1 thru 3 is generated but do not display the computer choice immediately. Number 1...
please help me fix this. I'm getting it all mixed up in user defined functions. here's the question. This week we'll write a C program that lets the user play the game of Rock, Paper, Scissors against the computer. Your program will call a user-defined function named display_rules that displays the rules of the game. It then proceeds to play the game. To determine the winner, your program will call another user- defined function called determine_winner that takes two integer...
Write a Python program (rock_paper_scissors.py) that allows two players play the game rock paper scissors. Remember the rules: 1. Rock beats scissors 2. Scissors beats paper 3. Paper beats rock The program should ask the users for their names, then ask them for their picks (rock, paper or scissors). After that, the program should print the winner's name. Note, the players may pick the same thing, in this case the program should say it's tie. when the user input an...
Objective: Write a program that simulates a game of rock, paper, scissors between a human and the computer in best 2 out of 3 rounds. Requirements: . The player can enter either "rock", "paper", or "scissors'". o If the player enters anything other than that the computer automatically gets a point . The computer randomly selects one of the gestures o Use the Random type to make this easier o Also make sure you import java.util.Random o You can use...