-1
I was studying about the Python language and, as a test, I played a game of Jokenpô.
To make it restart, I saw that I would have to put it inside a function to eventually return to it and restart the program, but for some reason, when I put the program inside a function it just doesn’t return anything when I run it.
Below I show the program in the current state, the problem started to occur when I inserted the program into a function.
#Jokenpô 
from random import randint
import time
def jokenpo():
    player = int(input('Digite 1 para PEDRA \nDigite 2 para PAPEL \nDigite 3 para TESOURA\n'))
    machine = randint(1, 3)
    if player == 1:
        print('Jo')
        time.sleep(1)
        print('Ken')
        time.sleep(1) 
        print('Pô!')
        print('Você escolheu pedra.')
        if machine == 1:
            print('A máquina escolheu Pedra, vocês empataram.')
        elif machine == 2:
            print('A máquina escolheu Papel, você perdeu.')
        elif machine == 3:
            print('A máquina escolheu Tesoura, você ganhou')
    if player == 2:
        print('Jo')
        time.sleep(1)
        print('Ken')
        time.sleep(1)
        print('Pô!')
        print('Você escolheu papel.')
        if machine == 1:
            print('A máquina escolheu Pedra, você ganhou.')
        elif machine == 2:
            print('A máquina escolheu Papel, vocês empataram.')
        elif machine == 3:
            print('A máquina escolheu Tesoura, você perdeu.')
    if player == 3:
        print('Jo')
        time.sleep(1)
        print('Ken')
        time.sleep(1)
        print('Pô!')
        print('Você escolheu tesoura')
        if machine == 1:
            print('A máquina escolheu Pedra, você perdeu.')
        elif machine == 2:
            print('A máquina escolheu Papel, você ganhou.')
        elif machine == 3:
            print('A máquina escolheu Tesoura, vocês empataram')
						
And when you called the function
jokenpoto execute it?– Woss
What do you mean? How do I call it? My goal is to make the program give you the option to restart you know, type a 'Want to play again? '' and do not close the prompt once the execution is finished.
– Ridolfi
Do you know what a function is and how it works? You just declared the function, but it will not run until you call it. Read more on Defining functions.
– Woss
Ah yes, I must call her after the statement, had completely ignored it. Thank you.
– Ridolfi