[Python] Is there a way to restart to a specific line?

Discussão em 'Python' iniciado por Stack, Abril 17, 2025.

  1. Stack

    Stack Membro Participativo

    Ok I would like to go back to a line of code when I type a specific number, but I don't know how to do that.

    I thought a while loop would work, but I need it to keep running after the input. I'm going to try to recreate the code:

    print( 'you have 5 attempts')

    Import random

    Cpu = random.randint(1,20)

    Avi = int(input())

    if Avi==Cpu:

    print('Great Job')

    Else:

    print('You Lose')
    Print('You have 4 attemps')

    Continue reading...

Compartilhe esta Página