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
Get step-by-step solutions from verified subject matter experts
