0

How can i hold back some values while using choice

>>> x
['Ace', 'King', 'Queen', 'Jack', 10, 9]

>>> choice(x),choice(x),choice(x),choice(x),choice(x)
(10, 'Jack', 9, 'King', 10)

Now i need to ask the user to hold back some values. If he chooses Jack for ex. I need to keep Jack aside and chose any four values from x. something like -

('Jack',10, 9, 'Queen', 'Ace') 

Also, Can i do the same with randint?

hmm
  • 37
  • 8

1 Answers1

0
import random

foo = ['a', 'b', 'c', 'd', 'e']
print(random.choice(foo))

Example from :: How to randomly select an item from a list?

Hopefully this is what you need (+code to maintain the list contents)

Community
  • 1
  • 1