How to Code PYTHON: *sort() and sorted() Functions* Tutorial

preview_player
Показать описание
Let's get started! 🔥🔥🔥 In this video, we will create few PYTHON 🐍 scripts to demonstrate Python *sort() and sorted() Functions*. With Python's built-in functions for sorting, sorting any sequence is very easy. Two such functions provided in Python are sorted() and sort() - both are used for sorting but are quite different in their own way. In this video, we will show their differences when used on a list, as well as how sorted() could be used on a tuple, a string, and a dictionary. In this tutorial, you will learn some basics in about 5 minutes!

📺 In this video , you will learn how to:
★ 0:10 Use sort() on a list
★ 0:50 Use reverse() on a list
★ 1:28 Use sorted() on a list
★ 2:04 Use reversed() on a list
★ 2:42 Use sorted() on a tuple
★ 3:24 Use sorted() on a string
★ 3:52 Use sorted() on a dictionary
★ 4:23 Use sorted() on items and values of a dictionary, with the reverse argument
★ 5:15 Use sorted() on a list, with the key argument
★ 5:50 Use sorted() on a nested list, with a lambda function in the key argument

Tips and Tricks:
► sort() function is very similar to sorted(). However, it returns nothing and makes changes to the original sequence.
► sort() is a method of list class and can only be used with lists, not string/tuples/dictionaries.
► sorted() method returns a new sorted list and does not change the original sequence.
► sorted() using a reverse argument - sorting will be in descending order if this value is True.
► sorted() using the key parameter - the function used for this parameter will transform each element before sorting.
► Recommendation: Use sorted() if the original (unsorted) data will need to be recovered.

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
Рекомендации по теме
Комментарии
Автор

📺 In this video, you will learn how to:
★ 0:10 Use sort() on a list
★ 0:50 Use reverse() on a list
★ 1:28 Use sorted() on a list
★ 2:04 Use reversed() on a list
★ 2:42 Use sorted() on a tuple
★ 3:24 Use sorted() on a string
★ 3:52 Use sorted() on a dictionary
★ 4:23 Use sorted() on items and values of a dictionary, with the reverse argument
★ 5:15 Use sorted() on a list, with the key argument
★ 5:50 Use sorted() on a nested list, with a lambda function in the key argument

CodingWithKids
Автор

You're doing a great job. Keep working on it.👍😃

mastergreen
Автор

You're doing a great job. Keep working on it 👍😃

mastergreen
welcome to shbcf.ru