Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the coding string integer playerScore integer computerScore for i = 1 ; i = 1 0 ; i = i + 1 integer playerSelection

In the coding string
integer playerScore
integer computerScore
for i =1; i =10; i = i +1
integer playerSelection
integer computerSelection
playerSelection = GetNextInput()
computerSelection = RandomNumber(1,3)
if playerSelection =1 and computerSelection =
Put "Player wins this round!" to output
playerScore = playerScore +1
else if playerSelection =2 and computerSelection =1
Put "Player wins this round!" to output
playerScore = playerScore +1
else if playerSelection =3 and computerSelection =2
Put "Player wins this round!" to output
playerScore = playerScore +1
else if playerSelection = computerSelection
Put "It's a tie!" to output
else
Put "Computer wins this round!" to output
computerScore = computerScore +1
end if
Put "Player score: " to output
Put playerScore to output
Put "
" to output
Put "Computer score: " to output
Put computerScore to output
Put "
" to output
end for
if playerScore > computerScore
Put "Player wins the game!" to output
else if playerScore computerScore
Put "Computer wins the game!" to output
else
Put "The game is a tie!" to output
end if
I keep getting a the message "Line 4: In loop expression, unknown word 'i'" and im not sure how to fix this so it could work
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions