Oct-23-2020, 03:44 PM
You don't need parentheses around the string assignments.
I'd probably prefer to put the text into a container (like a list/dict/tuple) rather than into 26 top-level variables.
But the main problem is that random.choice takes a single sequence. You're feeding it 26 individual variables. Wrap them in another pair of parentheses to make a tuple and it should work.
I'd probably prefer to put the text into a container (like a list/dict/tuple) rather than into 26 top-level variables.
But the main problem is that random.choice takes a single sequence. You're feeding it 26 individual variables. Wrap them in another pair of parentheses to make a tuple and it should work.
print(random.choice((a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z))