top of page
Search
techskill065

Tuples in Python





What are Tuples in Python?


A tuple refers to a collection of objects in python which are ordered and ca n’t be changed. The python objects then may be strings, lists, tuples, integers etc.


Characteristics and Features of Tuples in Python

· Insertion order is maintained The order in which fundamentals are added to the tuple is the order in which the affair will be displayed.


· Immutable Once if we make a tuple object, also we can not modify the content of the tuple object. This is the only characteristic which differentiates tuples from the lists.


· Tuple can store duplicates.


· Tuple can store the same type of objects and other types of objects as well.


· Index plays the main part in tuple.


· Tuple supports both positive and negative indicators. Positive indicator means forward direction (from left to right). Negative indicator means rearward direction (from right to left).


· We can produce a tuple by using gap () symbol. Parenthesis is discretionary but it’s recommended to use.


· Inside the tuple function in python every object should be separated by comma as a division.



When allowing about Python tuples and different data structures that are types of collections, it's useful to consider all the different collections you have on your computer your diverseness of lines, your song playlists, your browser bookmarks, your emails, the collection of tapes you can enter on a streaming service, and more.


Tuples are analogous to lists, but their values ca n’t be modified. Because of this, when you use tuples in your law, you're communicating to others that you do n’t aim for there to be changes to that product of values. Also, because the values don't change, your code can be optimized through the use of tuples in Python, as the code will be slightly briskly for tuples than for lists.




3 views0 comments

Comments


Post: Blog2_Post
bottom of page