Stone , paper , scissor game code
v1.1
import random
print('Enter\nY for yes\nN for no')
perm=str(input('Do you want to play : '))
while perm=='Y':
list=[1,2,3]
n= random.choice(list)
print('----------------\nType (1) for stone \nType (2) for paper \nType (3) for sissor')
user=int(input('Enter : '))
print('computer : ',n)
if user==n:
print('Its tie')
elif user==1 and n==2:
print('Computer wins')
elif user==1 and n==3:
print('You wins')
elif user==2 and n==1:
print('You wins')
elif user==2 and n==3:
print('Computer wins')
elif user==3 and n==1:
print('You wins')
elif user==3 and n==2:
print('You wins')
else:
print('!!Error!!\nwrong input')
else:
print('good bye')
v1.2
import random
print('Enter\nY for yes\nN for no')
perm=str(input('Do you want to play : '))
while perm=='Y':
list=['stone','paper','scissor']
n= random.choice(list)
# print('----------------\nType stone\nTypepaper\n'scissor'')
user=input('Enter : ')
print('computer : ',n)
if user==n:
print('Its tie')
elif user=='stone' and n=='paper':
print('Computer wins')
elif user=='stone' and n=='scissor':
print('You wins')
elif user=='paper' and n=='stone':
print('You wins')
elif user=='paper' and n=='scissor':
print('Computer wins')
elif user=='scissor' and n=='stone':
print('You wins')
elif user=='scissor' and n=='paper':
print('You wins')
else:
print('!!Error!!\nwrong input')
else:
print('good bye')
v1.3
import random
print('Enter\nY for yes\nN for no\nR for rules')
perm=str(input('Do you want to play : '))
a='----------------\nWinning Rules as follows :\nRock vs paper-> paper wins\nRock vs scissor-> Rock wins\npaper vs scissor-> scissor wins.\n----------------'
print('check rule by typing R\n----------------')
while perm=='Y':
list=['stone','paper','scissor']
n= random.choice(list)
user=input('Enter : ')
print('computer : ',n)
if user==n:
print('Its tie')
elif user=='stone' and n=='paper':
print('Computer wins')
elif user=='stone' and n=='scissor':
print('You wins')
elif user=='paper' and n=='stone':
print('You wins')
elif user=='paper' and n=='scissor':
print('Computer wins')
elif user=='scissor' and n=='stone':
print('You wins')
elif user=='scissor' and n=='paper':
print('You wins')
elif user=='R':
print(a)
else:
print('!!Error!!\nwrong input')
else:
print('good bye')