How to Code PYTHON: *Functions: Arbitrary Argument Lists and Keyword Arguments*

preview_player
Показать описание
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 🐍

For the setup, please read the followings before you begin:
2. Install Python and remember to select "Add Python... to PATH" when asked.
4. Install the Python extension for Visual Studio Code: Go to View and select Extensions, or select the Extensions icon, then search for python.

👇 SUBSCRIBE TO CODING WITH KIDS 👨🏻‍💻👩🏻‍💻 YOUTUBE CHANNEL NOW 👇

#CodingWithKids #PythonProgramming #PythonForBeginners
Рекомендации по теме
Комментарии
Автор

👦🏻👧🏻 Welcome to CODING WITH KIDS!
Hope you'll enjoy coding in PYTHON!

CodingWithKids