filmov
tv
Tuple Methods and Basic Operations in Python | Python Programming

Показать описание
Tuple:
Tuples are used to store multiple items in a single variable.
A Tuple is a collection which is ordered, unchangeable(immutable) and allow duplicate values.
Tuples are written with round brackets (parenthesis).
Create a Tuple:
Ex: t=(10,20,”robo”,40)
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.
Ex:
t=(“robo”,)
print(type(t))
t=(“robo”)
print(type(t))
Python Tuple Methods:
Python has two built-in methods that you can use on tuple.
1. count(): Return the number of times a specified value occurs in a table.
2. index(): Searches the tuple for a specified value and returns the position of there it was found.
Built-in Functions with Tuple:
Built-in functions like len(),max(),min(),sorted(),tuple(),sum(),all(),any(),enumerate() etc. are commonly used with tuple to perform different tasks.
Len():Return the length (the number of items) in the tuple.
EX: t=(10,20,”robo”,40)
print(len(t))
#PythonProgramming
#TupleMethods
#Pythontuples
#SBTechTuts
Tuple Methods and Basic Operations in Python | Python Programming
python
python progamming
python coding
python in telugu
portable
high-level
tuple
tuple methods
tuple functions
tuple basic operations
len
count
max
min
index
sorted
all
any
concatenation
sb tech tuts
sudhakar
bogam
in telugu
telugu
python tuple methods and operations
python online
learn python
Tuples are used to store multiple items in a single variable.
A Tuple is a collection which is ordered, unchangeable(immutable) and allow duplicate values.
Tuples are written with round brackets (parenthesis).
Create a Tuple:
Ex: t=(10,20,”robo”,40)
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.
Ex:
t=(“robo”,)
print(type(t))
t=(“robo”)
print(type(t))
Python Tuple Methods:
Python has two built-in methods that you can use on tuple.
1. count(): Return the number of times a specified value occurs in a table.
2. index(): Searches the tuple for a specified value and returns the position of there it was found.
Built-in Functions with Tuple:
Built-in functions like len(),max(),min(),sorted(),tuple(),sum(),all(),any(),enumerate() etc. are commonly used with tuple to perform different tasks.
Len():Return the length (the number of items) in the tuple.
EX: t=(10,20,”robo”,40)
print(len(t))
#PythonProgramming
#TupleMethods
#Pythontuples
#SBTechTuts
Tuple Methods and Basic Operations in Python | Python Programming
python
python progamming
python coding
python in telugu
portable
high-level
tuple
tuple methods
tuple functions
tuple basic operations
len
count
max
min
index
sorted
all
any
concatenation
sb tech tuts
sudhakar
bogam
in telugu
telugu
python tuple methods and operations
python online
learn python
Комментарии