資源簡介
代碼片段和文件信息
import?random
allList?=?[‘石頭‘‘剪刀‘‘布‘]
winList?=?[[?‘石頭‘‘剪刀‘][‘剪刀‘‘布‘][‘布‘‘石頭‘]]
chnum=-1
prompt?=‘‘‘
==歡迎參加石頭剪刀布游戲==
請選擇:
0石頭
1剪刀
2布
3我不想玩啦
============================
請選擇對應的數字:‘‘‘
while?True:
????chnum?=?input?(prompt)
????if?chnum?not?in?[‘0‘‘1‘‘2‘‘3‘]:
????????print?(“無效的選擇,請選擇0/1/2/3“)
????????continue
????
- 上一篇:100道Python練習題(附源碼)
- 下一篇:python抓取天地圖瓦片
評論
共有 條評論