Call Functions in Python 3

1

Hello, I was "playing" without Python, and I decided to do a mini-game, for the PC to play Jokempô with me (I AM INITIATING IN PROGRAMMING).

while pj <5 and pc <5:
def game()

But I came across the following problem.

def game()
         ^ SyntaxError: invalid syntax

Can anyone explain where I went wrong?

    
asked by anonymous 04.10.2017 / 14:59

1 answer

1

The structure blocks in python are made by indentation. So if you want to make a tie with the game function, you must indent 4 spaces before your call.

while pj <5 and pc <5:
    game()

Also for function game () to work, it should be declared before your call.

def game():
    # instruções da função

# bloco do while
    
04.10.2017 / 15:05