python-Training 1_ Scissors Game

Source: Internet
Author: User

#!/usr/bin/python
#coding =utf-8
Import Random
Xd={1: ' Scissors ', 2: ' Stone ', 3: ' Cloth '}
blist=[' scissors ', ' stone ', ' cloth '
#print Xd[1];
C=raw_input (' Number of offices: ')
If Str.isdigit (c):
C=int (c)
Compute=0
User=0
I=1
While C:
S=int (Random.uniform (1,4))
# s=3
# print Xd[s]
# print S
M=raw_input (' Please input stone scissors cloth: ')
if (m== ' scissors '):
A=1
if (m== ' stone '):
a=2
if (m== ' cloth '):
A=3
if (m in blist):
if (a==s):
print ' +str (i) + ' board draw \ n computer out: ' +xd[s]
C-=1;i+=1
Elif (A==1 and s==2) or (a==2 and s==3) or (A==3 and s==1):
print ' +str (i) + ' computer won \ nthe computer out: ' +xd[s '
C-=1;compute+=1;i+=1
Else
Print "+str" (i) + ' bureau you won the computer out: ' +xd[s '
C-=1;user+=1;i+=1
If C==0 and User==compute:
print ' Go to overtime '
c+= 1
Else
print ' re-enter: '
print ' Player vs computer \ n ' +str (user) + ': ' +str (COMPUTE);
"If (User==compute):
print ' final player and computer flat '
C+=1;i+=1 ""
if (User>compute):
print ' final player wins '
Else
print ' Ultimate Computer wins '
Else
print ' Please enter Number '

python-Training 1_ Scissors Game

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.