jeudi 7 septembre 2017

How to combine else statement with if in statement in python? [on hold]

The following code gives me the error

d = {1: 2, 3: 4}
if 1 in d:
    print('true!')
else print('no true!')



    else print('no true!')
             ^
SyntaxError: invalid syntax

How can I combine else and if in?

Aucun commentaire:

Enregistrer un commentaire