vendredi 23 mars 2018

if statement in print() python [on hold]

I am programming a little tic-tac-toe game and I have a question, because Python doesn't recognize my if statement in .format(). Here is the little code:

column = int(input("Spieler {0}, wähle eine Spalte (0-2): ").format(1 if piece == self.player_one else 2))
row = int(input("Spieler {0}, wählen eine Zeile (0-2): ").format(1 if piece == self.player_one else 2))

The problem that I have is that python does not recognize the 1 or 2. The print I get is:

Spieler {0}, wähle eine Spalte (0-2): 

Don't pay attention to the German part. Does anybody know a reason or maybe another solution how I can do that?

Aucun commentaire:

Enregistrer un commentaire