Looking at your code snippet - what do you think happens with the value generated from
random.randint(0,1)
? You do nothing with it, just discard it. In general you can assign it to a name (variable) for future use, or like in this case, directly return it. Your function does not return anything explicitly, so (implicitly) it returns None
import random def word(): return random.randint(0,1) y = word() print(y)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs