student = ['a', 'b', 'c', 'd', 'e', ' f', ' g' ]
number = 0
import random
while number < 32:
number += 1
print(number, random.choice(student))
input()
While creating a program that sets the order, the value selected as random.choice is not included in the next selection list, so that it is not a duplicate draw. What should I do?
python random
You can remove the pulled items as shown below.
import random
student = ['a', 'b', 'c', 'd', 'e', 'f', 'g' ]
for _ in range(len(student)):
choiceItem = random.choice(student)
student.remove(choiceItem)
print(choiceItem)
© 2024 OneMinuteCode. All rights reserved.