I don't know well, so I can't make the code neatly, but if I just make it turn around,
import random
list1 = ['grape' , 'banana' , 'grapefruit', 'melon']
list2 = []
list2.append(list1.pop(random.randrange(0,4)))
list2.append(list1.pop(random.randrange(0,3)))
list2.append(list1.pop(random.randrange(0,2)))
list2.append(list1.pop(random.randrange(0,1)))
if list2[0] == 'grape':
print('correct')
It hasn't been long since I learned Python, but I was going to try something, so I posted a source code. What should I do about this? I think it'd be better if you ask questions like this.
© 2024 OneMinuteCode. All rights reserved.