当我运行这个程序时:(python 3.3.1)
import random
import time
from random import randrange
print(' ')
print('I am thinking of a person...')
time.sleep(1)
print('He or she belongs to this group of people:')
people = 'Alice Elise Jack Jill Ricardo David Jane Sacha Thomas'.split()
loop = 0
while loop != 6:
group = []
person = randrange(0, len(people))
personName = people[person]
int(person)
group.append(personName)
del people[person]
loop = loop + 1
Run Code Online (Sandbox Code Playgroud)
我有时会收到此错误消息:
Traceback (most recent call last):
File "C:\Users\user\Python\wsda.py", line 132, in <module>
person = randrange(0, …Run Code Online (Sandbox Code Playgroud)