How to Code PYTHON: *Functions: Arbitrary Argument Lists and Keyword Arguments*
Let's get started! ??? In this video, we will write a few PYTHON ? scripts to demonstrate how to add *Arbitrary argument lists and keyword arguments* to functions ♻️. In the examples, we add code that creates a function accepting an arbitrary arguments list and showing the data type of the list, then another function to accept keyword arguments. In this tutorial, you will learn some basics in less than 5 minutes!
In this video, you will learn how to:
★ 0:08 Function that accepts an arbitrary arguments list
★ 1:33 Function that displays the content and data type of an arbitrary arguments list
★ 2:19 Function that accepts any number of named keyword arguments
Tips and Tricks:
► Use * before the input parameter to define an arbitrary arguments list. The variable stores a collection of the arguments that the function can iterate through.
► Data type of an arbitrary arguments list is tuple, which is immutable, meaning its contents can’t be changed or modified after its creation.
► Items in tuples are surrounded by parenthesis () whereas those in lists are surrounded by square brackets [].
► Use ** before the input parameter to define named keyword arguments.
► A specific keyword argument can be accessed by using the get() method with the key. As seen in the example, the get() method does not throw an exception when the given key is not found in the arguments.
WATCH MORE PYTHON TUTORIALS ?
https://www.youtube.com/playlist?list=PLYnuuwG097TxI0viOUfWD7sx_D_wRsGbo
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?sub_confirmation=1
#CodingWithKids #PythonProgramming #PythonForBeginners
Видео How to Code PYTHON: *Functions: Arbitrary Argument Lists and Keyword Arguments* автора Python творцы
Видео How to Code PYTHON: *Functions: Arbitrary Argument Lists and Keyword Arguments* автора Python творцы
Информация
2 декабря 2023 г. 22:26:41
00:03:38
Похожие видео