What is Tuple in Python | EP-10 Tuple in Python | How to Create Tuple in Python | Built-in Functions

Subscribers:
27,900
Published on ● Video Link: https://www.youtube.com/watch?v=VFn14YlvVYQ



Duration: 23:04
272 views
6


"""Python Tuple is a collection of objects separated by commas.
In some ways, a tuple is similar to a Python list in terms of
indexing, nested objects, and repetition but the main difference
between both is Python tuple is immutable(if its value cannot be
changed after it has been created.), unlike the Python list
which is mutable."""

#CreatingPythonTuples
"""There are various ways by which you can create a tuple in Python.
They are as follows:

1.Using round brackets
2.With one item
3.Tuple Constructor"""

1. Create Tuples using Round Brackets ()
Tuple = ()
print(Tuple)

Tuple_1 =("a",1,2.5)
print(Tuple_1)

2. Create a Tuple With One Item
"""syntax:
variable : tuple[int | str, ...] = (value1,value2....)
"""
Tuple_3 : tuple[int | str] =( 1,"q")
print(Tuple_3)

#NOTE
"""
In case your generating a tuple with a single element, make sure to add a
comma after the element.Let us see an example of the same.
"""
Tuple_4 = (77)
print(Tuple_4)
print(type(Tuple_4))
NOT a tuple

Tuple_5 = (8,)
print(Tuple_5)
print(type(Tuple_5))

#TupleConstructorinPython
"""To create a tuple with a Tuple constructor, we will pass the elements as
its parameters."""

Tuple_cons_1 =tuple("cybrosys")
print(Tuple_cons_1)
Tuple_cons_2 =tuple(("python","course"))
print(Tuple_cons_2)

#WhatisImmutableinTuples?
"""
Unlike lists, tuples are immutable. This means that once a tuple is created,
you cannot modify its elements or its size. You can't add, remove, or change
elements after the tuple is defined.
1. Ordered and immutable
2. Can hold mixed data types
3. Accessed by index (zero-based)
4. Can contain duplicates
"""
#tuples are indexed
Tuple_7 =(5,7.9,3)
print(Tuple_7[1])
print(Tuple_7[0])

#tuples contain duplicate element
Tuple_8 =(7,7,8,6,3,5,3,3,7)
print(Tuple_8)

adding an element
Tuple_8[1] = 100
print(Tuple_8)

#AccessingValuesinPythonTuples
"""Tuples in Python provide two ways by which we can access the elements of a
tuple.

Using a positive index
Using a negative index """

#Python Access Tuple using a Positive Index
"""
Using square brackets we can get the values from tuples in Python.
"""
positive = (1,2,3,"cybrosys")
print("value in positive[0]",positive[0])
print("value in positive[3]",positive[3])

#Python Access Tuple using a Negative Index

negative = (4,8,"qwert")
print("value in negative[-1]",negative[-1])
print("value in negative[-1]",negative[-3])

#python #pythonprogramming #programming #beginnerpython #tuple #tuples #explained #builtinfunctions #programmingtutorial #learnpython #TupleInPython #PythonTuples #CodingTutorial #PythonTutorials

Connect With Us:
—————————————
➡️ Website: https://www.cybrosys.com/
➡️ Email: info@cybrosys.com
➡️ Twitter:   / cybrosys  
➡️ LinkedIn:   / cybrosys  
➡️ Facebook:   / cybrosystechnologies  
➡️ Instagram:   / cybrosystech  
➡️ Pinterest:   / cybrosys  




Other Videos By Cybrosys Technologies


2024-07-14How to Create Invoice Upon Email in Odoo 17 Accounting App | Odoo 17 Functional Tutorials
2024-07-14How to Find & Print the Size of a Tuple in Python | EP-13 Find the Size of a Tuple | What is Tuple?
2024-07-11How to Create a Product in Odoo 18 POS | Odoo 18 Latest Features | Odoo 18 New & Upcoming Features
2024-07-11How to Sell Your Products in Odoo 17 Website App | Odoo 17 Website Tutorials | Functional Tutorials
2024-07-10What is Set in Python | EP-12 Sets in Python | How to Create Set in Python | Free Python Tutorials
2024-07-10Revamp in Product View in Odoo 18 | Latest Features in Odoo 18 | New & Upcoming Features in Odoo 18
2024-07-09How to Create an App Using Odoo 17 Studio | Customize App Using Odoo 17 Studio | Odoo 17 Tutorials
2024-07-08How to Add Language Translation in Odoo 17 | Internationalization | Adding Translation in Odoo 17
2024-07-08What is Tuple Operations in Python | EP-11 Tuple Operations in Python | Basic Tuple Operations
2024-07-08Latest Features in Odoo 18 | Upcoming Features in Odoo 18 | New Features in Odoo 18| EP-1 Tech Tonic
2024-07-07What is Tuple in Python | EP-10 Tuple in Python | How to Create Tuple in Python | Built-in Functions
2024-06-13How to Unbuild Order in Odoo 17 Manufacturing App | Odoo 17 Manufacturing Tutorials | Odoo 17 Videos
2024-06-12How to Manage Employee Assets in Horilla HRMS | Free HR Software | An Overview of Assets Management
2024-06-12How to Configure Access Rights of Manufacturing Orders in Odoo 17 Manufacturing App | Odoo 17 Videos
2024-06-11How to Manage Work Order Dependencies in Odoo 17 Manufacturing App | Odoo 17 Functional Tutorials
2024-06-11How to Configure Manufacturing in 3 Steps in Odoo 17 Manufacturing App | Odoo 17 Functional Tutorial
2024-06-10What is the Difference Between Search & Browse Methods in Odoo 17 | ORM Methods | Odoo 17 Videos
2024-06-10How to Make Work Centers Unavailable Using Time Off in Odoo 17 | Odoo 17 Functional Tutorials
2024-06-07How to Configure Split & Merge Manufacturing Orders in Odoo 17 Manufacturing App | Odoo 17 Tutorials
2024-06-07How to Gain Karma in Odoo 17 E-Learning | Odoo 17 E-Learning Tutorials | Odoo 17 Functional Tutorial
2024-06-06How to Configure Subcontracting in Odoo 17 Manufacturing App | Odoo 17 Functional Tutorials



Tags:
Python
Tuples
Tuple in Python
Python Tuples
Python Tutorial
Learn Python
Python Programming
Coding
Programming
Python Built-in Functions
Python Data Structures
Python Beginners
Python Advanced
Programming Tutorial
Python for Beginners
Python Full Course
Tuple
Tuples in Python
Create Tuple
Access Tuple Elements
Built-in Functions for Tuples
Beginner Python Tutorial
What is Tuple in Python
How to Create Tuple in Python
Tuple Built-in Functions
Free Python