简体   繁体   中英

Python While loops - don't work BREAK

I trying to create a simple game Tic Tac Toe. I'm a beginner in programming in Python.

The loop breaks when only 2 conditions are good. How to use this segment to meeting all conditions. That the loop breaks when all nastede1=X, nastede2=X and nastede3=X?

a=-1
while a <0:
    user_move()
    if ((nastede[1]==X) and (nastede[2]==X) and (nastede[3==X])):
        print("Game Over")
        break

You have a typo in your syntax. Replace (nastede[3==X]) with (nastede[3]==X])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM