1 import random 2 3 player=0 4 computer=0 5 play=int(input("玩家输入\n(0-剪刀,1-石头,2-布)")) 6 if play==0: 7 return play 8 elif play==1: 9 return play 10 elif play==2: 11 return play 12 else: 13 print("输入错误,请重新输入") 14 result=(play-com+4)%3-1 15 if result>0: 16 print("赢了!春暖花开,再来一局") 17 elif result==0 18 print("平局!") 19 else: 20 print("输了。手气不佳,别走开,决战到天明")