{"id":1486,"date":"2024-04-10T16:21:58","date_gmt":"2024-04-10T15:21:58","guid":{"rendered":"https:\/\/ramamm.com\/?p=1486"},"modified":"2024-04-10T16:22:01","modified_gmt":"2024-04-10T15:22:01","slug":"tuple","status":"publish","type":"post","link":"https:\/\/ramamm.com\/?p=1486","title":{"rendered":"Tuple"},"content":{"rendered":"<div>\n<div>#create an empty tuple<\/div>\n<div>a =()<\/div>\n<div>print(a)<\/div>\n<div>#create an empty tuple with tuple() function built in python<\/div>\n<div>tuplea = tuple()<\/div>\n<div>print(tuplea)<\/div>\n<div>#crete a tuple with different data type<\/div>\n<div>tuplex = (&#8220;apple&#8221;, True, 1.4, 4)<\/div>\n<div>print(tuplex)<\/div>\n<div>#tuple with number<\/div>\n<div>tuplex = 1, 4 , 3 , 7 , 22<\/div>\n<div>print(tuplex)<\/div>\n<div>#unpack tuple in several variable<\/div>\n<div>tuplex = 1,2 , 4<\/div>\n<div>print(tuplex)<\/div>\n<div>a1,b2,c3 = tuplex<\/div>\n<div>print(a1+b2+c3)#the number of variable should be equal to number of items<\/div>\n<div>#adding an item in tuple<\/div>\n<div>tuplex = (1,3,4,5,6,2,4,6)<\/div>\n<div>print(tuple)<\/div>\n<div>tuplex = tuplex +(8,)<\/div>\n<div>print(tuplex)<\/div>\n<div>#adding items in speific index<\/div>\n<div>tuplex = tuplex[:3]+(34,55,76)+tuplex[:3]<\/div>\n<div>print(tuplex)<\/div>\n<div>#converting tuple t string<\/div>\n<div>tuplex = (&#8216;a&#8217;,&#8217;p&#8217;,&#8217;p&#8217;,&#8217;l&#8217;,&#8217;e&#8217;)<\/div>\n<div>str = &#8221;.join(tuplex)<\/div>\n<div>print(str)<\/div>\n<div>#get any item of tuple<\/div>\n<div>tuplex = (&#8216;l&#8217;,&#8217;a&#8217;,&#8217;h&#8217;,&#8217;a&#8217;,&#8217;r&#8217;,&#8217;i&#8217;)<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>#create an empty tuple a =() print(a) #create an empty tuple with tuple() function built in python tuplea = tuple() print(tuplea) #crete a tuple with different data type tuplex = (&#8220;apple&#8221;, True, 1.4, 4) print(tuplex) #tuple with number tuplex = 1, 4 , 3 , 7 , 22 print(tuplex) #unpack tuple in several variable tuplex [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ub_ctt_via":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"featured_image_src":null,"author_info":{"display_name":"ramamm.com","author_link":"https:\/\/ramamm.com\/?author=1"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ramamm.com\/index.php?rest_route=\/wp\/v2\/posts\/1486"}],"collection":[{"href":"https:\/\/ramamm.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramamm.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramamm.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ramamm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1486"}],"version-history":[{"count":1,"href":"https:\/\/ramamm.com\/index.php?rest_route=\/wp\/v2\/posts\/1486\/revisions"}],"predecessor-version":[{"id":1487,"href":"https:\/\/ramamm.com\/index.php?rest_route=\/wp\/v2\/posts\/1486\/revisions\/1487"}],"wp:attachment":[{"href":"https:\/\/ramamm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramamm.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramamm.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}