kearney

自学还没成才的python猿

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

 

#剪刀、石头、布
import random
guess_list = ["石头", "剪刀", ""]
win_combination = [["", "石头"], ["石头", "剪刀"], ["剪刀", ""]]
while True:
    people = input('请输入:石头,剪刀,布\n').strip()
    computer = random.choice(guess_list)
    print('电脑出拳:'+computer)
    if people not in guess_list:
        print('咦~~弄啥类你!~~~')
continue if computer == people: print ('平手,再玩一次!') elif [computer, people] in win_combination: print ('电脑获胜!继续吧~~~') else: print ('你获胜!') break print('---------------------------------')

 

posted on 2017-06-13 18:06  Gino森  阅读(687)  评论(0编辑  收藏  举报