|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 hveagle 于 2022-9-21 19:08 编辑
题目700000003
20220919
休息!
上题目最佳答案
答案主人
ba21
- import random
- rpsLst = ['石头', '剪刀', '布']
- ask = 'Y'
- while ask.upper() != 'N':
- rps = input('Rock Paper Scissor:')
- cRpsIdx = random.randint(0, len(rpsLst)-1)
- cRps = rpsLst[cRpsIdx]
- rpsIdx = rpsLst.index(rps)
- rpsLen = len(rpsLst)
- if (rpsIdx-1)%rpsLen == cRpsIdx:
- print('%s,你输了' % cRps)
- elif (rpsIdx+1)%rpsLen == cRpsIdx:
- print('%s,你赢了' % cRps)
- else:
- print('%s平局' % cRps)
- ask = input('还要玩吗(Y/N):')
复制代码
本周进度
一 二 三 四 五 六 七
|
|