May-31-2020, 12:16 PM
Hello.
In Python, I am using the random module. I have used the random.choice() method to randomly pick from two strings:
instead of just
but it still does not work.
How am I able to fix this error? Thank you.
In Python, I am using the random module. I have used the random.choice() method to randomly pick from two strings:
import random variable = random.choice('string1','string2') print(variable)However, when I run it, the following error occurs:
Error:TypeError: choice() takes two positional arguments, but three were given.
I have also used from numpy import random
instead of just
import random
but it still does not work.
How am I able to fix this error? Thank you.