I'm trying to create a small Python program which calls a random student in lessons then it removes this student from the list till all other students are called.
Example :
- ME
- You
- Others
I want to call randomly one and then remove it from the list so the next time it would be only
- You
- Others
I've wrote this code but it keeps repeating students without first calling all of them.
import random
klasa = {1 :'JOHN', 2 : 'Obama' , 3 : 'Michele' , 4 : 'Clinton'}
ran = []
random.seed()
l = random.randint(1,4)
while l not in ran:
ran.append(l)
print(klasa[l])
for x in ran:
if x != None:
ran.remove(x)
else:
break