{"id":3308,"date":"2022-11-21T19:41:47","date_gmt":"2022-11-21T19:41:47","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=3308"},"modified":"2022-11-21T19:41:48","modified_gmt":"2022-11-21T19:41:48","slug":"python-tuples","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/python-tuples\/","title":{"rendered":"Python Tuples | Tuples Python With Example"},"content":{"rendered":"<p style=\"text-align: center;\">Python Tuples<\/p>\n<p>Now, we are going to learn about another interesting concept in python, which is tuples. As of now, you might be quite familiar with the concept of list, which is just used to store a collection of data. A tuple is also used to store a collection of data.<\/p>\n<p>Basically, a tuple is similar to a list, in many terms, like indexing etc., but the tuples here are immutable, unlike the lists, which are mutable. This simply means that you cannot alter, insert, or remove elements from the tuple directly.<\/p>\n<h2 style=\"text-align: center;\">Python Tuples<\/h2>\n<p>We are going to explore the tuples a lot, looking after some different things, like how to create tuples, and accessing the elements, iterating through tuples and some different methods related to tuples. So, Let\u2019s dive in to understand tuples. Here is an insight of what we are going to cover here &#8211;<\/p>\n<ul>\n<li>Creating a tuple<\/li>\n<li>Getting the length of tuple<\/li>\n<li>Accessing the tuple elements<\/li>\n<li>Are tuples Mutable?<\/li>\n<li>Tuple slicing<\/li>\n<li>Tuple with one element?<\/li>\n<li>Iterating through tuples<\/li>\n<li>Tuple methods<br \/>\n\u25e6 The count method<br \/>\n\u25e6 The index method<\/li>\n<li>Unpacking a tuple<\/li>\n<li>When to use tuples?<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Python Tuples Now, we are going to learn about another interesting concept in python, which is tuples. As of now, you might be quite familiar with the concept of list, which is just used to store a collection of data. A tuple is also used to store a collection of data. Basically, a tuple is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[26,27],"class_list":{"0":"post-3308","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-python-tutorial","7":"tag-python","8":"tag-python-tutorial"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=3308"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3308\/revisions"}],"predecessor-version":[{"id":4087,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/3308\/revisions\/4087"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=3308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=3308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=3308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}