ROCK_PAPER-SCISSORS PYTHON MINI PROJECT

 import random

game_list=['ROCK','PAPER','SCISSORS']
computer = c = 0
command = p = 0
print("Score : Computer" +str(c)+ "Player"+str(p))

run=True
while run:
computer_choice=random.choice(game_list)
command=input("---ROCK----PAPER---SCISSIORS---OR---QUITE---")
if command==computer_choice:
print("----TIE---")
elif command=='ROCK':
if computer_choice=='SCISSORS':
print("----PLAYER WON----")
P+=1
else:
print("-----COMPUTER WON----")
c+=1
elif command=='PAPER':
if command=='ROCK':
print("----PLAYER WON----")
P+=1
else:
print("-----COMPUTER WON----")
c+=1
elif command == 'SCISSORS':
if computer_choice == 'PAPER':
print("----PLAYER WON----")
P += 1
else:
print("-----COMPUTER WON----")
c += 1
elif command=='QUIT':
break
else:
print("----WRONG COMMAND------")
print("PLAYER: "+command)
print("COMPUTER : "+computer_choice)
print(" ")
##print("SCORE :COMPUTER"+ str(c)+"")
print("Score : Computer" + str(c) + "Player" + str(p))
print(" ")



-------------------------------------------------------------------------------------------------------------------------------------------

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.
PyDev console: using IPython 6.4.0
Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
runfile('C:/Users/Madhurima  Moulik/RockPaperScissiors.py', wdir='C:/Users/Madhurima  Moulik')
Score : Computer0Player0
---ROCK----PAPER---SCISSIORS---OR---QUITE--->? ROCK
-----COMPUTER WON----
PLAYER: ROCK
COMPUTER : PAPER
  
Score : Computer1Player0
  
---ROCK----PAPER---SCISSIORS---OR---QUITE--->? PAPER
-----COMPUTER WON----
PLAYER: PAPER
COMPUTER : ROCK
  
Score : Computer2Player0
  
---ROCK----PAPER---SCISSIORS---OR---QUITE--->? SCISSIOS
----WRONG COMMAND------
PLAYER: SCISSIOS
COMPUTER : PAPER
  
Score : Computer2Player0
  
---ROCK----PAPER---SCISSIORS---OR---QUITE--->? QUITE
----WRONG COMMAND------
PLAYER: QUITE
COMPUTER : PAPER
  
Score : Computer2Player0
  
---ROCK----PAPER---SCISSIORS---OR---QUITE---

Comments

Popular posts from this blog

java chapter11 practice question on abstruct class and interfaces

DAY 12 -AZURE DP900(Microsoft Azure Data Fundamentals: Explore non-relational data in Azure)

java exercise4