importrandomguess_list=["石头","剪刀","布"]guize=[["布","石头"],["石头","剪刀"],["剪刀","布"]]
whileTrue:computer=random.choice(guess_list)people=input('请输入:石头,剪刀,布').strip()
ifpeoplenotinguess_list:people=input('重新请输入:石头,剪刀,布').strip()continueifcomputer==people:print("平手,再玩一次!")
elif[computer,people]inguize:print("电脑获胜!")else:print("人获胜!")break
python怎么学习?python怎么入门?python在哪学?python怎么学才快?不用担心,这里为大家提供了python速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
THE END