Question: Python code for the following pseudocode DEFINE guessingGame function(Secret_Letter) { DECLARE our_guess = 1; DECLARE our_reward = 0; DECLARE guess_Letter; DECLARE check_op; LOOP WHILE our_guess

Python code for the following pseudocode

DEFINE guessingGame function(Secret_Letter)

{

DECLARE our_guess = 1;

DECLARE our_reward = 0;

DECLARE guess_Letter;

DECLARE check_op;

LOOP WHILE our_guess < 4:

{

guess_Letter = take_INPUT();

check_op = CALL checkGuess(guess_Letter,Secret_Letter);

IF check_op == 1:

{

PRINT(guessLetter is after SecretLetter);

}

ELSE IF check_op == -1:

{

PRINT(guessLetter is before SecretLetter);

}

ELSE{

BREAK LOOP;

}

INCREMENT our_guess by 1;

}

IF our_guess == 1:{

REWARD = 26;

}

ELSE IF our_guess == 2:{

REWARD = 13;

}

ELSE IF our_guess == 3:{

REWARD = 7;

}

ELSE {

REWARD = 0;

}

RETURN REWARD;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!