What does "TypeError:choice() takes exactly 1 arguments (4 given)" mean | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What does "TypeError:choice() takes exactly 1 arguments (4 given)" mean

I'm trying to do something like print(random.choice(one, two, three, four)) where one, two, three, etc, were previously defined. Why doesn't it work? Thanks for helping!

20th Dec 2018, 4:49 AM
Aaron S
Aaron S - avatar
1 Answer
+ 2
You need to make them into a list first. And use the list as argument to choice() print(random.choice([one, two, three, four] ))
20th Dec 2018, 5:19 AM
Gordon
Gordon - avatar