Home > Back-end >  My debugger does not show the return values of the programs when the program finishes
My debugger does not show the return values of the programs when the program finishes

Time:07-13

in the output pane ı cannot see the values that ı entered before when the program finishes (when using debugger). I think, normally ı should see the guess that ı made between the two lines in the output( ı draw an arrow).

CodePudding user response:

You have multiple errors in your code so far, maybe you are about to write the logic for it after you have the desired output, but I am anyway going to mention it.

1.If you want the user to guess multiple times you need to use a loop. For example:

while True:
    if ():
        print()
    elif():
        print()
    else:
        print("Correct")
        break

2.Also, if you want the user to guess again you would need to take input inside the if-elif structure.

3.To print the user input you can do as previous suggestion and put it inside the print-statement inside the if-statement like this:

answer = 5
guess = int(input("Please guess a number between 1 and 10:"))

while True:
    if guess < answer:
        print("You guessed:", guess)
        guess = int(input())
    .
    .
    .
    else:
        print("You guessed:", guess)
        print("Congrats, it was correct!")
        break

CodePudding user response:

you can add:

print(guess)

before all the "if" statements if you want to see the input value printed

  • Related