{"id":209,"date":"2023-08-12T21:56:00","date_gmt":"2023-08-12T20:56:00","guid":{"rendered":"https:\/\/noiseonthenet.space\/noise\/?p=209"},"modified":"2023-09-17T21:54:36","modified_gmt":"2023-09-17T20:54:36","slug":"python-tutorial-basic-data-structures","status":"publish","type":"post","link":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/","title":{"rendered":"Python Tutorial: Basic data structures"},"content":{"rendered":"<img decoding=\"async\" src=\"https:\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-3-scaled.jpg\" alt=\"jacek-dylag-nhCPOp4A2Xo-unsplash-3-scaled.jpg\" \/> Photo by <a href=\"https:\/\/unsplash.com\/@dylu?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Jacek Dylag<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/nhCPOp4A2Xo?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\">Unsplash<\/a>\n\n<script src=\"https:\/\/modularizer.github.io\/pyprez\/pyprez.min.js\"><\/script>\n<div id=\"outline-container-org4bba60d\" class=\"outline-2\">\n<h2 id=\"org4bba60d\">Lists and Tuples (and Strings, again)<\/h2>\n<div class=\"outline-text-2\" id=\"text-org4bba60d\"><\/div>\n<div id=\"outline-container-orgb2e0b4f\" class=\"outline-3\">\n<h3 id=\"orgb2e0b4f\">List literals<\/h3>\n<div class=\"outline-text-3\" id=\"text-orgb2e0b4f\">\n\n list can be constructed with the square parens; they can hold objects of different kinds and even lists; all objects are separated by a comma\n\n<pyprez-editor>\n[] # an empty list\n[\"hi\"] # a list with just one element\n[1,\"ho!\",[3.5, (0+1j)]] # a nested list with multiple elements\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-org335aca2\" class=\"outline-3\">\n<h3 id=\"org335aca2\">List access<\/h3>\n<div class=\"outline-text-3\" id=\"text-org335aca2\">\n\n list elements can be accessed via the square brackets operator.\n\nList indices are 0-based, i.e. the first element has index 0, the second has index 1 etc.\n\nLists can be accessed backward with negative indices\n\nWhen the index exceed the list size an error is generated\n\n<pyprez-editor>\n[\"hi\", \"mom\"][1] # returns \"mom\"\n[\"thanks\", \"for\", \"all\", \"the\", \"fish\"][-2] # returns \"the\"\n[][1] # throws an exception\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-org3ae2b62\" class=\"outline-3\">\n<h3 id=\"org3ae2b62\">Splices<\/h3>\n<div class=\"outline-text-3\" id=\"text-org3ae2b62\">\n\n In order to show some result, starting from this paragraph I will use the <code>print<\/code> function. A more detailed description of functions will be presented later.\n\nWhen applied to lists, the square bracket operator accepts splices, returning sublists.\n\nA splice has two possible forms\n<ul class=\"org-ul\">\n \t<li>start : stop<\/li>\n \t<li>start : stop : step<\/li>\n<\/ul>\nWhere start, stop and step are integers.\n\nThe first represent the first index to be taken, the second the first excluded index and the step represent the periodicity of the extraction\n\nAll three elements are optional, when missing\n<ul class=\"org-ul\">\n \t<li>start will point to the beginning of the string<\/li>\n \t<li>end will point to the end of the string<\/li>\n \t<li>step will be 1<\/li>\n<\/ul>\nNegative steps are allowed: switching the meaning of start and stop\n\n<pyprez-editor>\nprint(['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'][1:4])\nprint(['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'][1:6:2])\nprint(['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'][:4])\nprint(['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'][4::2])\nprint(['the', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog'][-3:9:2])\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-org4a452d2\" class=\"outline-3\">\n<h3 id=\"org4a452d2\">Accessing strings with index and splice<\/h3>\n<div class=\"outline-text-3\" id=\"text-org4a452d2\">\n\n index and splice work in the very same way with strings as they do with lists\n\n<pyprez-editor>\nprint(\"Here we are, born to be Kings\"[5])\nprint(\"Here we are, born to be Kings\"[-3])\nprint(\"Here we are, born to be Kings\"[:4])\nprint(\"Here we are, born to be Kings\"[-5:])\nprint(\"Here we are, born to be Kings\"[2:8:2])\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-org0219dd6\" class=\"outline-3\">\n<h3 id=\"org0219dd6\">Tuple literals<\/h3>\n<div class=\"outline-text-3\" id=\"text-org0219dd6\">\n\n Tuple can contain ordered sequences of various kinds of objects, as list do\n\nTuple literal constructor is the comma, but as the empty tuple is represented by an empty parens () usually parens are always used in tuple literals for better readability\n\nIndices and tuples also apply as in lists; the main difference with list is related to mutability, a theme I will explain later.\n\n<pyprez-editor>\nprint((True,\"hi\",3.14159,0+1j)[-1])\nprint((True,\"hi\",3.14159,0+1j)[2])\nprint((True,\"hi\",3.14159,0+1j)[:3])\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-org0b20a6b\" class=\"outline-3\">\n<h3 id=\"org0b20a6b\">Operators on lists and tuples<\/h3>\n<div class=\"outline-text-3\" id=\"text-org0b20a6b\">\n\n as we already saw with strings the + operator concatenates lists and tuples with similar containers (i.e. tuples can't be concatenated with lists and vice versa)\n\nThe * operator with an integer repeats the content of the sequence\n\n<pyprez-editor>\nprint([\"This\", \"is\", \"not\"] + [\"America\"])\nprint((\"hi\", \"ho\") * 3)\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-org4f5e2b1\" class=\"outline-3\">\n<h3 id=\"org4f5e2b1\">String formatting with modulo and tuples<\/h3>\n<div class=\"outline-text-3\" id=\"text-org4f5e2b1\">\n\n the modulo operator accepts a string on the left side and a tuple or a list on the right side.\n\nthe result is equivalent to the c \"sprintf\" function: the string content will be interpolated with the content of the sequence; placeholders begin with a % sign and use a letter code to define the expected type of datum. Here is an incomplete list\n<table border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\">\n<colgroup>\n<col  class=\"org-left\" \/>\n<col  class=\"org-left\" \/>\n<\/colgroup>\n<thead>\n<tr>\n<th scope=\"col\" class=\"org-left\">sequence<\/th>\n<th scope=\"col\" class=\"org-left\">data type<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td class=\"org-left\">%s<\/td>\n<td class=\"org-left\">any object<\/td>\n<\/tr>\n<tr>\n<td class=\"org-left\">%d<\/td>\n<td class=\"org-left\">integers<\/td>\n<\/tr>\n<tr>\n<td class=\"org-left\">%f<\/td>\n<td class=\"org-left\">numbers (fixed point format)<\/td>\n<\/tr>\n<tr>\n<td class=\"org-left\">%e<\/td>\n<td class=\"org-left\">numbers (scientific format)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\nBetween the % sign and the letter some combination of digits and symbols can modify the output; here are some example: please refer to a printf manual for more details\n\n<pyprez-editor>\nprint(\"|%10s| and |%-10s| space padding\" % (\"positive\", \"negative\"))\nprint(\"fixed point %.4f and scientific %.4e modifiers\" % (3.14159, 3.14159 \/ 1000))\n<\/pyprez-editor><\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org19b4723\" class=\"outline-2\">\n<h2 id=\"org19b4723\">Dictionaries and Sets (and more Strings)<\/h2>\n<div class=\"outline-text-2\" id=\"text-org19b4723\"><\/div>\n<div id=\"outline-container-org05a7bca\" class=\"outline-3\">\n<h3 id=\"org05a7bca\">Set iterals<\/h3>\n<div class=\"outline-text-3\" id=\"text-org05a7bca\">\n\n Sets are containers which behave as math sets:\n<ul class=\"org-ul\">\n \t<li>they contain just one copy of each value<\/li>\n \t<li>it is possible to efficiently test if a value belongs to the sets<\/li>\n<\/ul>\nmore operations on set will be described later\n\nSet literal constructor is the curl brace.\n\n<pyprez-editor>\n{} # an empty set\n{\"Hi\"} # a set with only one item\nprint({2,2,3,1,\"Joe\"}) # duplicate item in literals will be dropped\n<\/pyprez-editor> lists are not allowed to be set values while tuples are. This is related to their immutability as we will see later\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org6d3e19b\" class=\"outline-3\">\n<h3 id=\"org6d3e19b\">Dictionary literals<\/h3>\n<div class=\"outline-text-3\" id=\"text-org6d3e19b\">\n\n dictionaries or maps associate keys with values.\n\nAs their literal constructor is a list of key-value pairs; each pair is divided by a colon and the list is surrounded by curl braces\n\nAs with other containers there is no restriction to use different types of objects in the same container.\n\nLists are not valid keys while tuples are (as with set contents).\n\n<pyprez-editor>\n{\"hello\":1, 10:True, (1,2,3,4):3.14159}\n<\/pyprez-editor><\/div>\n<\/div>\n<div id=\"outline-container-orgecb96e3\" class=\"outline-3\">\n<h3 id=\"orgecb96e3\">Dictionary access<\/h3>\n<div class=\"outline-text-3\" id=\"text-orgecb96e3\">\n\n to retrieve a value from a dictionary, its key can be passed through the square bracket operator\n\n<pyprez-editor>\nprint({\"hello\":1, 10:True, (1,2,3,4):3.14159}[\"hello\"])\n<\/pyprez-editor> if the selected key is missing an error is generated\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org2e283c4\" class=\"outline-3\">\n<h3 id=\"org2e283c4\">Set and dictionary operators<\/h3>\n<div class=\"outline-text-3\" id=\"text-org2e283c4\">\n\n the <code>in<\/code> operator can check if an element is part of a set or if there is a key in a dictionary\n\n<pyprez-editor>\nprint(2 in {10, \"Joe\", 2})\nprint(2 in {\"hello\":1, 10:True, (1,2,3,4):3.14159})\n<\/pyprez-editor> while this operator also works on tuples and lists its time complexity is linear while it is constant on dictionaries and sets, so it is not recommended to use it with them.\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org999d08f\" class=\"outline-3\">\n<h3 id=\"org999d08f\">String formatting with modulo and dictionaries<\/h3>\n<div class=\"outline-text-3\" id=\"text-org999d08f\">\n\n Dictionaries can be used as the right operand in string formatting expressions with the modulo operator.\n\nThis can be useful when\n<ul class=\"org-ul\">\n \t<li>formatting strings with many data without worrying about order<\/li>\n \t<li>rusing the same value multiple times<\/li>\n<\/ul>\nplaceholders modifiers will include key names in parens\n\n<pyprez-editor>\nprint(\"on %(date)s the temperature is %(temperature).2f degrees\" % {\"temperature\":2.3, \"date\":\"Monday, January 1st\"})\nprint(\"My name is %(surname)s, %(first name)s %(surname)s\" % {\"first name\":\"James\", \"surname\":\"Bond\"})\n<\/pyprez-editor><\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"how to use basic containers","protected":false},"author":1,"featured_media":232,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4],"tags":[7],"class_list":["post-209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-language-learning","tag-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python Tutorial: Basic data structures - Noise On The Net<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Tutorial: Basic data structures - Noise On The Net\" \/>\n<meta property=\"og:description\" content=\"how to use basic containers\" \/>\n<meta property=\"og:url\" content=\"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/\" \/>\n<meta property=\"og:site_name\" content=\"Noise On The Net\" \/>\n<meta property=\"article:published_time\" content=\"2023-08-12T20:56:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-17T20:54:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1707\" \/>\n\t<meta property=\"og:image:height\" content=\"2560\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"marco.p.v.vezzoli\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"marco.p.v.vezzoli\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/\"},\"author\":{\"name\":\"marco.p.v.vezzoli\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"headline\":\"Python Tutorial: Basic data structures\",\"datePublished\":\"2023-08-12T20:56:00+00:00\",\"dateModified\":\"2023-09-17T20:54:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/\"},\"wordCount\":957,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"image\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1\",\"keywords\":[\"Python\"],\"articleSection\":[\"Language learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/\",\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/\",\"name\":\"Python Tutorial: Basic data structures - Noise On The Net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1\",\"datePublished\":\"2023-08-12T20:56:00+00:00\",\"dateModified\":\"2023-09-17T20:54:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2023\\\/09\\\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1\",\"width\":1707,\"height\":2560},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2023\\\/08\\\/python-tutorial-basic-data-structures\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Tutorial: Basic data structures\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#website\",\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\",\"name\":\"Noise On The Net\",\"description\":\"Sharing adventures in code\",\"publisher\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\",\"name\":\"marco.p.v.vezzoli\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\",\"caption\":\"marco.p.v.vezzoli\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g\"},\"description\":\"Self taught assembler programming at 11 on my C64 (1983). Never stopped since then -- always looking up for curious things in the software development, data science and AI. Linux and FOSS user since 1994. MSc in physics in 1996. Working in large semiconductor companies since 1997 (STM, Micron) developing analytics and full stack web infrastructures, microservices, ML solutions\",\"sameAs\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/marco-paolo-valerio-vezzoli-0663835\\\/\"],\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/author\\\/marco-p-v-vezzoli\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Tutorial: Basic data structures - Noise On The Net","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/","og_locale":"en_US","og_type":"article","og_title":"Python Tutorial: Basic data structures - Noise On The Net","og_description":"how to use basic containers","og_url":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/","og_site_name":"Noise On The Net","article_published_time":"2023-08-12T20:56:00+00:00","article_modified_time":"2023-09-17T20:54:36+00:00","og_image":[{"width":1707,"height":2560,"url":"https:\/\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg","type":"image\/jpeg"}],"author":"marco.p.v.vezzoli","twitter_card":"summary_large_image","twitter_misc":{"Written by":"marco.p.v.vezzoli","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#article","isPartOf":{"@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/"},"author":{"name":"marco.p.v.vezzoli","@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"headline":"Python Tutorial: Basic data structures","datePublished":"2023-08-12T20:56:00+00:00","dateModified":"2023-09-17T20:54:36+00:00","mainEntityOfPage":{"@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/"},"wordCount":957,"commentCount":0,"publisher":{"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"image":{"@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1","keywords":["Python"],"articleSection":["Language learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/","url":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/","name":"Python Tutorial: Basic data structures - Noise On The Net","isPartOf":{"@id":"https:\/\/noiseonthenet.space\/noise\/#website"},"primaryImageOfPage":{"@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#primaryimage"},"image":{"@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1","datePublished":"2023-08-12T20:56:00+00:00","dateModified":"2023-09-17T20:54:36+00:00","breadcrumb":{"@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#primaryimage","url":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1","contentUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1","width":1707,"height":2560},{"@type":"BreadcrumbList","@id":"https:\/\/noiseonthenet.space\/noise\/2023\/08\/python-tutorial-basic-data-structures\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/noiseonthenet.space\/noise\/"},{"@type":"ListItem","position":2,"name":"Python Tutorial: Basic data structures"}]},{"@type":"WebSite","@id":"https:\/\/noiseonthenet.space\/noise\/#website","url":"https:\/\/noiseonthenet.space\/noise\/","name":"Noise On The Net","description":"Sharing adventures in code","publisher":{"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/noiseonthenet.space\/noise\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982","name":"marco.p.v.vezzoli","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g","caption":"marco.p.v.vezzoli"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/b9d9aab1df560bc14d73b0b442198f196ce39e7c7a38df1dc22fec0b97f17da9?s=96&d=mm&r=g"},"description":"Self taught assembler programming at 11 on my C64 (1983). Never stopped since then -- always looking up for curious things in the software development, data science and AI. Linux and FOSS user since 1994. MSc in physics in 1996. Working in large semiconductor companies since 1997 (STM, Micron) developing analytics and full stack web infrastructures, microservices, ML solutions","sameAs":["https:\/\/noiseonthenet.space\/noise\/","https:\/\/www.linkedin.com\/in\/marco-paolo-valerio-vezzoli-0663835\/"],"url":"https:\/\/noiseonthenet.space\/noise\/author\/marco-p-v-vezzoli\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/09\/jacek-dylag-nhCPOp4A2Xo-unsplash-scaled.jpg?fit=1707%2C2560&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pdDUZ5-3n","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/comments?post=209"}],"version-history":[{"count":5,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/209\/revisions\/240"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/media\/232"}],"wp:attachment":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}