Could somebody please help? The while loop terminates when the correct number is given and when the loop condition guesses is true. But the 2nd elif doesn't display. It immediately prints the statement at the end of the program.
Suppose that in line 7, the user guess equals the number. Then the while loop is skipped, and the last line is printed. If, on the other hand, the user guesses wrong, but the guess in line 21 is correct, the while-loop is exited and again the last line is printed.
In your last line, check whether guess == number, or numGuess == 5, and then print the congratulations or otherwise.
There are three kinds of actuaries: those who can count, and those who can't.
Happily living in the valley of the dried frogs with a few tiny ads.