本帖最后由 朱志鑫 于 2019-3-27 19:00 编辑
# a = input("请输入姓名:")
# if a.isalpha()== False:
# print("输入不正确,请重新输入")
# else:
# print("您输入的用户名为:%s"% a)
# age = (input("请输入年龄:"))
# if age.isdecimal() == True:
# age = int(age)
# if age in range(0,101) :
# print("您输入的年龄为%s岁" % age)
# else:
# print("您输入的有误,请重新输入1")
# else:
# print("您输入的有误,请重新输入")
# my_tuple = ("hello","python","itcast","hello")
# a = list(("hello","python","itcast","hello"))
# a[0]="nihaoya"
# a[1]="heaaaa"
# a[2]="wobuhao"
# a[3]="heiheihei"
# while a:
# r1 = a.pop(0)
# r2 = a.pop(0)
# r3 = a.pop(0)
# r4 = a.pop(0)
# c = (r1,r2,r3,r4)
# print(c)import random
balls = ["r1","r2","r3","b1","b2","b3"]
wb = ["w1","w2","w3","w4"]
boxs = []
for a in wb:
boxs.append([a])
c = boxs.pop()
c = c.pop()
balls.append(c)
for d in balls:
a = random.randint(0,2)
boxs[a].append(d)
print(boxs)
|
组图打开中,请稍候......
|