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 in Python by Vikas
72 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 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 in Python by Mohammad
• 2,820 points
34 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
• 160 points
29 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
21 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
• 12,200 points
68 views
+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 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 168 views
+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 in Python by Jimmy
9 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 in Python by Fez
15 views