Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
shuru1
#python 3.5.2 print("Tic tac toe") board = ["-", "-", "-", "-", "-", "-", "-", "-", "-"] def disp(board): print(board[0] + " | " + board[1] + " | " + board[2] + " 1 | 2 | 3") print(board[3] + " | " + board[4] + " | " + board[5] + " 4 | 5 | 6") print(board[6] + " | " + board[7] + " | " + board[8] + " 7 | 8 | 9") print("X's Turn.") print("Choose a position from 1-9\n") pos=int(input()) if pos==1: board[0]="x" disp(board) elif pos==2: board[1]="x" disp(board) elif pos==3: board[2]="x" disp(board) elif pos==4: board[3]="x" disp(board) elif pos==5: board[4]="x" disp(board) elif pos==6: board[5]="x" disp(board) elif pos==7: board[6]="x" disp(board) elif pos==8: board[7]="x" disp(board) elif pos==9: board[8]="x" disp(board) else: print("pls insert between 1 to 9") print("Now O's turn") print("Choose a position from 1-9\n") poso=int(input()) error="choose another position" if poso==1 and pos==1: print(error) elif poso==2 and pos==2: print(error) elif poso==3 and pos==3: print(error) elif poso==4 and pos==4: print(error) elif poso==5 and pos==5: print(error) elif poso==6 and pos==6: print(error) elif poso==7 and pos==7: print(error) elif poso==8 and pos==8: print(error) elif poso==9 and pos==9: print(error) elif poso==1: board[0]="o" disp(board) elif poso==2: board[1]="o" disp(board) elif poso==3: board[2]="o" disp(board) elif poso==4: board[3]="o" disp(board) elif poso==5: board[4]="o" disp(board) elif poso==6: board[5]="o" disp(board) elif poso==7: board[6]="o" disp(board) elif poso==8: board[7]="o" disp(board) elif poso==9: board[8]="o" disp(board) else: print("pls insert between 1 to 9")
run
|
edit
|
history
|
help
0
🙆👌
Ugly number
PyRegSub
miyabhai
Palindrome using recursion
Lakshya chouhan
Rectangle Perimiter
Q2
31 dec
Python input