The use of the global keyword enables functions to modify variables outside of their scope. These functions may then include side effects that may not be apparent to users of that function, making the code harder to understand.

Remove the global statement, if possible.

  • Python Language Reference: The global statement.