Python Global and Local Variables

preview_player
Показать описание
Python Global and Local Variables.
python uses pass by object reference, which can be difficult to understand at first.
In my simple example you pass a variable to the function, but when the function makes a change to it, it is only changing a local variable and the global variable remains unchanged.

Adding the keyword global allows the function to make changes to a global variable.
Рекомендации по теме
Комментарии
Автор

Throughout my entire CS 118 journey, these additional videos have always served justice when I needed additional resources. Thank you!

appelzoa
join shbcf.ru