Skip to content
Advertisement

increase the value of x by 1 [closed]

    x=1
    if display == old_display:
      x=x+1
      print(x)
      print(stages[7-x])

I need the value of x to increase by 1 when the condition display == old display is true

I tried to set the condition with if statement and when it is true i need x to decrease by 1. This is a part of hang man game and this part of code is to display the hang man structure when choosing wrong letter.

Advertisement

Answer

if display == old_display:
    x -=1

this snippet decreases x by 1 every time display == old_display

Advertisement