How to Code PYTHON: *Return Function and Variable Scope in Python*

Published: 27 January 2021
on channel: Coding With Kids
196
9

Let's get started! 🔥🔥🔥 In this video, we will write a few PYTHON 🐍 scripts to demonstrate how to define and use functions ♻️. In the examples, we create a function that returns a single value by using the return keyword, then we add a new function that returns a list. Finally, we write a new function that demonstrates variable scope in a function to help you understand the scope of variables declared both inside and outside a function. In this tutorial, you will learn some basics in about 5 minutes!

In this video, you will learn how to:
★ 0:09 Function that returns a value
★ 1:19 Function that returns a list
★ 3:06 Function that demonstrates variable scope in a function

Tips and Tricks:
► Capture the returned value of a function by assigning it to a variable.
► Returned value of a function can also be a list that contains multiple values.
► Scope is a value's accessibility inside and outside a code structure like a function's code block.
► Value cannot be accessed outside the code block of a function in which it was declared and initialized because the variable is hidden and unavailable outside the code block.
► Variables defined outside a function don't affect variables defined inside a function unless your code returns the inside value and then uses it.

WATCH MORE PYTHON TUTORIALS 🐍
   • 🐍 Python Coding for Beginners  

For the setup, please read the followings before you begin:
1. Download latest Python: https://www.python.org/downloads/
2. Install Python and remember to select "Add Python... to PATH" when asked.
3. Download and install latest Visual Studio Code: https://code.visualstudio.com/Download
4. Install the Python extension for Visual Studio Code: Go to View and select Extensions, or select the Extensions icon, then search for python.

Python - a programming language used by world-class companies such as Amazon.com, Alphabet (Google), Facebook, Twitter, and NASA.

👇 SUBSCRIBE TO CODING WITH KIDS 👨🏻‍💻👩🏻‍💻 YOUTUBE CHANNEL NOW 👇
https://youtube.com/CodingWithKids?su...

#CodingWithKids #PythonProgramming #PythonForBeginners


On this page of the site you can watch the video online How to Code PYTHON: *Return Function and Variable Scope in Python* with a duration of online in good quality, which was uploaded by the user Coding With Kids 27 January 2021, share the link with friends and acquaintances, this video has already been watched 196 times on youtube and it was liked by 9 viewers. Enjoy your viewing!