You have a variable named unlucky. Now its scope is the main() function.
Redefine unlucky so that it becomes a top-level variable with a scope one level higher.
______________________
This is usually not a good idea. However, the task is needed to understand what a top-level variable is.