Python : Using global variables in a function

preview_player
Показать описание
How can I create or use a global variable in a function?

You can use a global variable within other functions by declaring it as global within each function that assigns a value to it.
Рекомендации по теме
Комментарии
Автор

Thank you very much. the "global"-feature was exactly that what I was searching for.

autismuskaefer
Автор

Thank you. This explained it better than the book I am reading lol.

demoncookie
Автор

it says global variable cannot be declared at the module level. pls help. i will subscribe for sure

firebolt