Defined variable is not defined All you need to do is import the sys, random, and time modules and define the variable win.