I have a block of code with
import random as r
value = r.choice(r.randint(10, 30), r.randint(50, 100))
print (value)
Why does it give me the fo
choice
takes a sequence of items to choose from, not varargs. Wrap the arguments to make an anonymous tuple
or list
and it'll work, changing:
value = r.choice(r.randint(10, 30), r.randint(50, 100))
to either of:
value = r.choice((r.randint(10, 30), r.randint(50, 100))) # Tuple
value = r.choice([r.randint(10, 30), r.randint(50, 100)]) # List