20190919—1

. 1  Import Random
 2 cai_quan_you_xi = [ ' rock ' , ' scissors ' , ' cloth ' ]
 . 3 Computer = The random.choice (cai_quan_you_xi)
 . 4 User = INPUT ( ' Enter: rock, paper, scissors ' )
 . 5  the while User Not  in cai_quan_you_xi :
 . 6      Print ( ' input error, please re-enter " )
 . 7      User = iNPUT ()
 . 8  Print ( " _____ _____ battle process ')
 . 9  Print ( ' PC an S% ' % Computer)
 10  Print ( ' User an S% ' % User)
 . 11  IF Computer == User:
 12 is      Print ( " draw " )
 13 is  elif (Computer == ' stone '  and User == ' cloth ' ) or (Computer == ' scissors '  and User == ' stone ' ) or(Computer == ' cloth '  and User == ' scissors ' ):
 14      Print ( ' users won ' )
 15  the else :
 16      Print ( ' User lost ' )

 

Guess you like

Origin www.cnblogs.com/yssshiny/p/11550234.html