Python code Tic Tac Toe game

0 votes
I'm trying to write a python code for Tic Tac Toe game. I currently have a code that selects a player and asks the player to select a sign. I need help in writing the code for selecting the other player and making the other player select a sign. Can anybody help me out with this? Thank you
May 28, 2019 in Python by Vikas
640 views

1 answer to this question.

0 votes

You could use random.shuffle

from random import shuffle

players = ['Player 1', 'Player 2']
shuffle(players)
player1, player2 = players

print(f"First Turn: {player1}")
sign_player_1 = input(f"{player1}, Choose a sign for yourself: ")
sign_player_2 = input(f"{player2}, Choose a sign for yourself: ")
answered May 28, 2019 by Idam

Related Questions In Python

0 votes
1 answer

How to draw a tic tac toe board in python?

Following is a code to draw a ...READ MORE

answered Jul 31, 2019 in Python by Mohammad
• 3,210 points
789 views
0 votes
1 answer

Normal Python code equivalent to given list comprehension

You can try this code list1=[] for i in ...READ MORE

answered Jun 8, 2018 in Python by jain12
• 170 points
49 views
0 votes
1 answer

GAE: python code to check if i'm on dev_appserver or deployed to appspot

I don't know if you still need ...READ MORE

answered Sep 10, 2018 in Python by anonymous
59 views
+1 vote
1 answer

How to use GUI that comes with Python to test your code?

Hey @alex0809, When your testing a website ...READ MORE

answered Sep 24, 2018 in Python by Vardhan
• 13,070 points
107 views
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 546 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

How to encode Python source code?

Python allows you to encode the source ...READ MORE

answered May 14, 2019 in Python by Jimmy
35 views
0 votes
1 answer

Checkers that can check hints in python source code

Static type checkers such as Mypy, Pyre, ...READ MORE

answered Jun 7, 2019 in Python by Fez
42 views