热门

最新

红包

立Flag

投票

同城

我的

发布
m0_56852291
洪荒宇宙py
4 年前
truem0_56852291

求大神指点,只循环10次,怎么写代码

def ball__name(red,blue):
'''红色的乒乓球33个,输出6个不同的数字,
蓝色的乒乓球16个,输出1个
'''
import random
tone = []
while True:
reds = random.randint(1,33)
if reds not in tone:
tone.append(reds)
if len(tone) == 6:
tone.sort()
#print(tone)
blues = random.randint(1,16)
tone.append(blues)
break
print(tone)
for i in range(ball__name(red,blue)):
i += ball__name(red,blue)
print(i)
continue
ball__name(1,1)

你问我答
CSDN App 扫码分享
分享
4
1
打赏
  • 复制链接
  • 举报
下一条:
哪位好心人能不能帮帮新手指正一下python,这里嵌套列表要怎样改呀?
立即登录