0% found this document useful (0 votes)
22 views2 pages

Python

The document describes a rock-paper-scissors game between a user and computer where the user and computer randomly select rock, paper, or scissors each round and points are tracked for each win until the user enters 'q' to quit and see the final scores.

Uploaded by

akash yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Python

The document describes a rock-paper-scissors game between a user and computer where the user and computer randomly select rock, paper, or scissors each round and points are tracked for each win until the user enters 'q' to quit and see the final scores.

Uploaded by

akash yadav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import random

r= ["r","p","s"]

d={'r':"rock",'p':"paper",'s':"scissors",'q':"quit"}

i=0

a=0

while True:

l=input("enter you choice:")

print("user has choosen",d[l])

x=random.choice(r)

print("computers has choosen",d[x])

if l=='q':

print("user's score",a)

print("computer's score",i)

if i>a:

print("computer won with ",i,"points")

elif i==a:

print("match drawn")

else :

print("user won with",a,"points")

exit()
elif l==x :

print("match drawn")

elif l=="rock" and x=="paper" or l=="scissors" and x=="rock" or x=="scissors"


and l=="paper":

print ("computer wins")

i=i+1

else:

print("you won")

a=a+1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy