Skip to content
Advertisement

Python random.choice same output

I’m trying to random some strings in a variable,

JavaScript

And when I’m running my script all of them are the same every time,

JavaScript

I like to random my variable every time I’m calling it, like,

JavaScript

Advertisement

Answer

This is basically the same as

JavaScript

A variables value only changes when you assign it:

JavaScript

If you want a new random value, you need to call the function again:

JavaScript
Advertisement