Local variables: Python functions define a scope for variables

Опубликовано: 11 Октябрь 2023
на канале: PatchyPython
12
0

Variables defined within a Python function are by default local to the function, so that function code does not interfere with global variables. This allows you to have variables with the same name in the main program and in a function. Variables local to the function will "mask" global variables while the function is executed. Local variables are then mopped up when the function returns, and cannot be accessed from outside the function. Check out the notebooks linked below for more information on functions in Python.

Embedded video, part of the following courses:
Computer Programming at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/42ttakps
Coding for Scientists at Queen Mary, University of London
Jupyter notebook: https://tinyurl.com/5hav5u8m

Notebooks will open on Google Colab - no installation required


На этой странице сайта вы можете посмотреть видео онлайн Local variables: Python functions define a scope for variables длительностью часов минут секунд в хорошем качестве, которое загрузил пользователь PatchyPython 11 Октябрь 2023, поделитесь ссылкой с друзьями и знакомыми, на youtube это видео уже посмотрели 12 раз и оно понравилось 0 зрителям. Приятного просмотра!