lundi 26 août 2019

If statement keeps returning a syntax error, why is this happening? (Python)

Programming a simple if statement between two integers and its giving a syntax error. Both of the integers are already defined.

I have tried changing from = to ==, but that changes nothing. Also tried turning the two variables directly into integers by putting int(example) around them but nothing changes.

char1_6dice = random.randint(1, 6)
char2_6dice = random.randint(1, 6)

if(char1_6dice = char2_6dice):   <-- line 29
    print("text")

It should just print text if they are the same but instead it says: "invalid syntax (, line 29)" (Note: the if statement is line 29)

Aucun commentaire:

Enregistrer un commentaire