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
2,108 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
3 answers

How to draw a tic tac toe board in python?

def printTable():             for i in range(1,10):                     print(" ",end=' ')                     if(i%3==0 ...READ MORE

answered Oct 11, 2020 in Python by Sumit Nagpal
11,578 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
774 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 11, 2018 in Python by anonymous
893 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,150 points
941 views
0 votes
2 answers
+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 7, 2019 in Python by Neha
• 330 points

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

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
4,043 views
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
812 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
894 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP