Westonci.ca is the ultimate Q&A platform, offering detailed and reliable answers from a knowledgeable community. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.

"Simon Says" is a memory game where "Simon" outputs a sequence of 10 characters (R, G, B, Y) and the user must repeat the sequence. Create a for loop that compares each character of the two strings. For each matching character, add one point to user_score. Upon a mismatch, end the loop. (PYTHON)

Simon Says Is A Memory Game Where Simon Outputs A Sequence Of 10 Characters R G B Y And The User Must Repeat The Sequence Create A For Loop That Compares Each C class=

Sagot :

Answer:

Explanation:

See attached for assistance

View image itsty1992

The program illustrates the use of loops.

Loops are used to perform operations that need to be repeated in a certain number of times

In this case, the characters of simon_pattern will be compared to the characters of user_pattern.

The missing code segment is as follows:

for i in range(10):

   if(user_pattern[i] == simon_pattern[i]):

       user_score+=1

   else:

       break;

#This statement iterates through the characters of user_pattern and simon_pattern

for i in range(10):

#This compares the corresponding characters

   if(user_pattern[i] == simon_pattern[i]):

#If the characters match, the user_score is incremented by 1

       user_score+=1

#If otherwise,

   else:

#The loop is forcefully closed

       break;

Read more about loops at:

https://brainly.com/question/13486964