Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
move = input()
if move in ('1', '2', '3', '4', '5', '6', '7', '8', '9') and (int(move) not in (gamelist)):
plyr2list.append(int(move))
gamelist.append(int(move))
print (gamelist) #debug
position[int(move)-1] = ('O')
printboard()
movecount = movecount + 1
plyr2wintest()
elif move not in ('1', '2', '3', '4', '5', '6', '7', '8', '9'):
print ('That is not a valid move! Try again')
else: print ('That move is taken!, Try again')

#end game
if winner == True:
print ('Congrats!')
else: print ('Its a tie BOI!')
print (' ')

#playagain
answer = 0
valid = False
print ('Would you like to play again (y/n)')
while valid == False: #waits until valid answer is submitted
answer = input()
if answer == 'y':
print ('aight, resetting...')
valid = True
elif answer == 'n':
print ('aight, cya')
print (' ') #ASCII art up in here cause why not
print(' * ,MMM8&&&. *')
print(' MMMM88&&&&& .')
print(' MMMM88&&&&&&&')
print(' * MMM88&&&&&&&&')
print(' MMM88&&&&&&&&')
print(' MMM88&&&&&&')
print(' MMM8&&& *')
print(' |\___/| ')
print(' ) ( . ')
print(' =\ /=')
print(' )===( Thanks for playing *')
print(' / \ ')
print(' | |')
print(' / \ ')
print(' \ / ')
print(' _/\_/\_/\__ _/_/\_/\_/\_/\_/\_/\_/\_/\_/\_ ')
print(' | | | |( ( | | | | | | | | | | ')
print(' | | | | ) ) | | | | | | | | | | ')
print(' | | | |(_( | | | | | | | | | | ')
print(' | | | | | | | | | | | | | | | ')
print(' By Me yay| | | | | | | | | ')
valid = True
playgame = False
else: print ('answer not valid, please use y or n')
#End

**His code:**

#!/usr/bin/python
"""Noughts and Crosses."""

import sys

def Input(*args):
"""Kludge to handle python 2 and 3."""
if sys.version_info.major >= 3:
return input(*args)
return raw_input(*args)

bye = r"""
* ,MMM8&&&. *
MMMM88&&&&& .
MMMM88&&&&&&&
* MMM88&&&&&&&&
MMM88&&&&&&&&
MMM88&&&&&&
MMM8&&& *
|\___/|
) ( .
=\ /=
)===( Thanks for playing *
/ \
| |
/ \
\ /
_/\_/\_/\__ _/_/\_/\_/\_/\_/\_/\_/\_/\_/\_
| | | |( ( | | | | | | | | | |
| | | | ) ) | | | | | | | | | |
| | | |(_( | | | | | | | | | |
| | | | | | | | | | | | | | |
By Me yay | | | | | | | | |
"""


def Play():
"""Play one round of noughts and crosses."""
position = [' ' for _ in range(9)]

print ("What is player 1's name?")
name1 = Input()
print ("Thanks %s, What's player 2's name?" % name1)
name2 = Input()
print ('So %s is X and %s is O.' % (name1, name2))
Input('Press Enter to continue...')

PrintBoard(position)

players = [(name1, 'X'), (name2, 'O')]