Skip to content

Spoke Right

Education for everyone

https://spokeright.com
Primary Menu
  • Home
  • Our Services
    • Translation
    • Interpretation
    • Transcription
    • Voice-Over
    • Proofreading
    • Content writing
  • Free Education
    • Learn Android Studio
    • Learn Python
    • Learn MongoDB
    • Learn MySql
    • Learn React
    • Montessori Education
  • Spoke Right News
  • Earn Online
  • Classic Games by Spoke Right
    • TicTac
    • Checkers
    • Foosball
    • Billiards
    • Master Chess
    • Logic Game
  • Contact Us
Download Now
  • Home
  • Learn Python
  • What are tuples in Python
  • Learn Python

What are tuples in Python

Spoke Right December 6, 2022 1 min read

Python Tuples

Python tuple is a collection or an array which is used to store various types of data.

Features of Python Tuples:

  • They are ordered and unchangeable.
  • They are written within round brackets.
  • They can store multiple types of data.
  • They are immutable. Thus, it cannot be modified.
  • Python Tuples supports various operations.
  • The elements of a python tuple are separated by commas and starts with index 0.

Python Tuples Methods:

METHODSUSES
cmp()To compare two tuples.
count()Returns the number of times a specified value occurs in a tuple.
index()Searches the tuple for a specified value and returns the position of where it was found.
min()To get the minimum value from the tuple.
max()To get the maximum value from the tuple..
len()To get the number of elements in a tuple.
tuple()To convert a sequence type to a tuple.

Python Tuples Operators:

OPERATORSSYMBOLSUSES
Concatenation+To add two tuples.
Replication*To repeat the tuple a specific number of times.
Slicing[i:j]To get a sub-tuple of specified start and end index.
DeletingdelTo delete an element from the tuple.

Examples:

a =  ("python", "java", "php", "HTML", "javascript", "CSS", "Bootstrap")
print "\n"
print "Tuple is:"
print a
print "\n"
 
print "Get the element at position 0."
print(a[0])
print "\n"
 
print "Get the elements from position 1 to position 4."
print(a[1:4])
print "\n"
 
print "Get the total length."
print(len(a))
print "\n"
 
print "Delete the tuple."
del a
print a
print "\n"

Continue Reading

Previous: What are list methods in Python
Next: What is python dictionary in python

Related Stories

What is Data Statistics And Analysis With Java And Python
9 min read
  • Learn Python

What is Data Statistics And Analysis With Java And Python

December 7, 2022
How do I get the date in Python
2 min read
  • Learn Python

How do I get the date in Python

December 7, 2022
What is an exception handler in Python
2 min read
  • Learn Python

What is an exception handler in Python

December 7, 2022

This AD Will support Us

Support Us

Coding Ustad LTD Support
Coding Ustad LTD Support

Coding Ustad LTD

Coding Ustad LTD
Coding Ustad LTD

Recent Posts

  • How to Install Node.js and npm on CentOS 7
  • How to Install Node.js and npm on CentOS 7
  • How to Install CentOS Web Panel (CWP) on CentOS 7
  • The Power of Marketing in Real Estate: A Guide to Boost Your Business
  • Vehicle Verification in Pakistan

Get free Hosting

Hostens.com - A home for your website

You may have missed

How to Install Node.js and npm on CentOS 7
4 min read
  • Coding Ustad LTD
  • Education for Everyone

How to Install Node.js and npm on CentOS 7

May 3, 2023
How to Install Node.js and npm on CentOS 7
4 min read
  • Coding Ustad LTD
  • Education for Everyone

How to Install Node.js and npm on CentOS 7

May 2, 2023
How to Install CentOS Web Panel (CWP) on CentOS 7
3 min read
  • Coding Ustad LTD
  • Education for Everyone

How to Install CentOS Web Panel (CWP) on CentOS 7

May 2, 2023
The Power of Marketing in Real Estate: A Guide to Boost Your Business https://thaikadar.com/secureinvestment/
2 min read
  • Article By Spoke Right
  • Blog By Spoke Right
  • Circular Byte Private Limited

The Power of Marketing in Real Estate: A Guide to Boost Your Business

January 30, 2023
  • Home
  • Our Services
  • Free Education
  • Spoke Right News
  • Earn Online
  • Classic Games by Spoke Right
  • Contact Us
Copyright © All rights reserved. | MoreNews by AF themes.