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

Veröffentlicht am: 27 Mai 2021
auf dem Kanal: Coding With Kids
136
4

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 🐍
   • 🐍 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


Auf dieser Seite können Sie das Online-Video How to Code PYTHON: *sort() and sorted() Functions* Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Coding With Kids 27 Mai 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 136 Mal angesehen und es wurde von 4 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!