|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- while len(list1) < 7: # list1 = []
- redi = random.randint(1,33)
- if redi not in list1:
- list1 = list1.append(redi)
- else:
- continue
- if len(list1) == 7:
- redi_blue = random.randint(1,17)
- list1 = list1.append(redi_blue)
- print(list1)
复制代码
- Traceback (most recent call last):
- File "<pyshell#19>", line 1, in <module>
- while len(list1) < 7:
- TypeError: object of type 'NoneType' has no len()
复制代码
大佬们求助呀...不懂
你这代码BUG有点多,我帮你全部改过来了
- import random
- list1 = []
- while len(list1) < 7: # list1 = []
- redi = random.randint(1,33)
- if redi not in list1:
- list1.append(redi)
- else:
- continue
- if len(list1) == 7:
- redi_blue = random.randint(1,17)
- list1.append(redi_blue)
- print(list1)
复制代码
|
|