Загрузка...

Python Training Program Session 13 (Part 1) || Advanced Built-in Data Types || Tuples

Hello Everyone! Today in this video I am going to explain Advanced Built-in Data Types in which we learn about Tuples and its operations. ✻ I really hope you find this video useful. Tuples : A tuple is a collection which is ordered and unchangeable. In Python tuples are written with round brackets (). Access Tuple Items : You can access tuple items by referring to the index number, inside square brackets. Negative Indexing : Negative indexing means beginning from the end, -1 refers to the last item, -2 refers to the second last item etc. Range of Indexes : You can specify a range of indexes by specifying where to start and where to end the range. When specifying a range, the return value will be a new tuple with the specified items. Remember that the first item has index 0. Change Tuple Values : Once a tuple is created, you cannot change its values. Tuples are unchangeable, or immutable as it also is called. But there is a workaround. You can convert the tuple into a list, change the list, and convert the list back into a tuple. Tuple Length : To determine how many items a tuple has, use the len() method. Add Items : Once a tuple is created, you cannot add items to it. Tuples are unchangeable. But we discussed in the video about the methods to add items. Create Tuple With One Item : To create a tuple with only one item, you have to add a comma after the item, otherwise Python will not recognize it as a tuple. Remove Items : You cannot remove items in a tuple. Tuples are unchangeable, so you cannot remove items from it, but you can delete the tuple completely. Join Two Tuples : To join two or more tuples you can use the + operator. The tuple() Constructor : It is also possible to use the tuple() constructor to make a tuple. Converting Between Lists and Tuples : You can use the built-in list() function to convert a tuple to a list, and the built-in tuple() function to convert a list to a tuple. #Python #PythonTraining #JupyterNotebook #PythonForBeginners #TrainingProgram #Learning #Tuples #DataTypes --------------------------------------------------------------------------- THANK YOU so much for watching! Please make sure to LIKE and SHARE the video and SUBSCRIBE to the channel for more such videos :) --------------------------------------------------------------------------- CONNECT WITH ME ON: ✻ LinkedIn: https://www.linkedin.com/in/sunidhi-pandey-96008b192/ ✻ GitHub: https://github.com/sunidhi2001 ✻ YouTube channel: https://www.youtube.com/channel/UCypX76paWuY76JC0rtbG61w ✻ Instagram : https://www.instagram.com/20sunidhi/

Видео Python Training Program Session 13 (Part 1) || Advanced Built-in Data Types || Tuples автора Python курсы
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки