{"id":149,"date":"2022-11-20T20:06:00","date_gmt":"2022-11-20T19:06:00","guid":{"rendered":"https:\/\/noiseonthenet.space\/noise\/?p=149"},"modified":"2024-03-30T22:23:59","modified_gmt":"2024-03-30T21:23:59","slug":"python-tutorial-literals-values-operators-and-expressions","status":"publish","type":"post","link":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/","title":{"rendered":"Python tutorial: literals, values, operators and expressions"},"content":{"rendered":"<div id=\"orgce438ce\" class=\"figure\">\n\n<img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?ssl=1\" alt=\"david-clode-5uU8HSpfwkI-unsplash-reduced.jpg\" \/>\n\n<\/div>\nPhoto by <a href=\"https:\/\/unsplash.com\/@davidclode?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" data-bcup-haslogintext=\"no\">David Clode<\/a> on <a href=\"https:\/\/unsplash.com\/photos\/5uU8HSpfwkI?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText\" data-bcup-haslogintext=\"no\">Unsplash<\/a>\n\nIn the previous post I explained how to launch a python interactive command line or REPL.\n\nYou can enter data and expressions into it by typing \u201cliterals\u201d or text which python can transform into numbers or other values.\n\nTo follow this post I suggest to open a REPL and type into it; when done type enter and see what happens\n<div id=\"outline-container-orgec1362e\" class=\"outline-2\">\n<h2 id=\"orgec1362e\">Numbers<\/h2>\n<div id=\"text-orgec1362e\" class=\"outline-text-2\">\n\nthe python interpreter reads the code and translate it into bytecode \u2013 a lower level language which is then executed.\n\nThis translation process consists in reading code text and create data structures which represents data objects and actions to be performed in memory\n\nData can be read from formats which are called literals: there can be different ways to represent the same object.\n\nHere we will go through some of the numeric formats and their object representation\n\nTry to type these literals into the CLI and python will return a \u201ccanonical\u201d representation of the equivalent numeric object\n\n<\/div>\n<div id=\"outline-container-orge118dd4\" class=\"outline-3\">\n<h3 id=\"orge118dd4\">Integers<\/h3>\n<div id=\"text-orge118dd4\" class=\"outline-text-3\">\n\ninteger values can be represented in multiple ways:\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">decimal<\/span>\n<span style=\"color: #da8548; font-weight: bold;\">1000000<\/span>\n<span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">decimal with underscore for readability<\/span>\n1_000_000\n<span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">hexadecimal<\/span>\n0xAA19\n<span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">binary<\/span>\n0b1001010\n<span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">octal<\/span>\n0o675\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org2d9ffb5\" class=\"outline-3\">\n<h3 id=\"org2d9ffb5\">Floats<\/h3>\n<div id=\"text-org2d9ffb5\" class=\"outline-text-3\">\n\nfloating point values can be represented with floating point or scientific format\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">floating point<\/span>\n-<span style=\"color: #da8548; font-weight: bold;\">123.4<\/span>\n<span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">scientific<\/span>\n-<span style=\"color: #da8548; font-weight: bold;\">1<\/span>.234e2\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-orgb1202fe\" class=\"outline-3\">\n<h3 id=\"orgb1202fe\">Complex<\/h3>\n<div id=\"text-orgb1202fe\" class=\"outline-text-3\">\n\npython supports complex numbers literals with cartesian representation\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\">(<span style=\"color: #da8548; font-weight: bold;\">1<\/span>*2j)\n<span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">also floating point can be used in the cartesian format<\/span>\n(<span style=\"color: #da8548; font-weight: bold;\">1.0<\/span>+<span style=\"color: #da8548; font-weight: bold;\">2<\/span>.0j)\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org648e168\" class=\"outline-3\">\n<h3 id=\"org648e168\">Operator and expressions on numbers<\/h3>\n<div id=\"text-org648e168\" class=\"outline-text-3\">\n\nordinary infix operators are available for all numeric types, with the ordinary precedence rules.\n\nPrecedence can be adjusted by means of parethesis as usual.\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\">(<span style=\"color: #da8548; font-weight: bold;\">2<\/span> + <span style=\"color: #da8548; font-weight: bold;\">3<\/span>) * <span style=\"color: #da8548; font-weight: bold;\">4<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">20<\/span>\n<span style=\"color: #da8548; font-weight: bold;\">3<\/span> \/ <span style=\"color: #da8548; font-weight: bold;\">4<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">0.75 promoted to float<\/span>\n<span style=\"color: #da8548; font-weight: bold;\">3<\/span> \/\/ <span style=\"color: #da8548; font-weight: bold;\">4<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">0 integer division<\/span>\n<span style=\"color: #da8548; font-weight: bold;\">3<\/span> ** <span style=\"color: #da8548; font-weight: bold;\">4<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">81 integer power<\/span>\n(<span style=\"color: #da8548; font-weight: bold;\">2<\/span>+3j) * (<span style=\"color: #da8548; font-weight: bold;\">2<\/span>-3j) <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">25 complex product<\/span>\n<\/pre>\n<\/div>\nfor integer numbers also binary operators are useful:\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\">0b1001 | 0b0101 <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields 0b1101 or 13<\/span>\n0b1001 &amp; 0b1001 <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields 0b0001 or 1<\/span>\n0b1001 ^ 0b0101 <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields 0b1100 or 12<\/span>\n~ 0b0101 <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields 0b1010 or 10<\/span>\n<\/pre>\n<\/div>\ninteger numbers also have modulo operator\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #da8548; font-weight: bold;\">13<\/span> % <span style=\"color: #da8548; font-weight: bold;\">4<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields 1<\/span>\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org39e5da4\" class=\"outline-2\">\n<h2 id=\"org39e5da4\">Strings<\/h2>\n<div id=\"text-org39e5da4\" class=\"outline-text-2\">\n\nStrings are data sequances mostly used for human readable text; python strings are of two kind:\n<ol class=\"org-ol\">\n \t<li>Unicode text strings: each readable character can be represented by one or more bytes<\/li>\n \t<li>Binary strings: each character will be represented by exactly one bytes, non-readable bytes by escaped hexadecimal sequences of two digits<\/li>\n<\/ol>\n<\/div>\n<div id=\"outline-container-orgfaa7bc8\" class=\"outline-3\">\n<h3 id=\"orgfaa7bc8\">Text strings<\/h3>\n<div id=\"text-orgfaa7bc8\" class=\"outline-text-3\">\n\nstring literals are surrounded by single quotes <code>'<\/code> or double quotes <code>\"<\/code>\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #83898d;\">\"hi mom\"<\/span>\n<span style=\"color: #83898d;\">'hi mom'<\/span>\n<\/pre>\n<\/div>\nwhen the python REPL returns the canonical representation it uses only the single quote\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org9dfde13\" class=\"outline-3\">\n<h3 id=\"org9dfde13\">Triple quote<\/h3>\n<div id=\"text-org9dfde13\" class=\"outline-text-3\">\n\ntext in a string can be surrounded by triple quotes <code>\"\"\"<\/code> or <code>'''<\/code>, this allows to introduce multiline string literals\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-pyton\">\"\"\"hi\nmom\"\"\"\n<\/pre>\n<\/div>\nwhen typing multiline expressions the CLI prompt switch to <code>...<\/code>\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org42eecf6\" class=\"outline-3\">\n<h3 id=\"org42eecf6\">Escaping and Unicode<\/h3>\n<div id=\"text-org42eecf6\" class=\"outline-text-3\">\n\n<img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2023\/10\/unicode_art.jpg?ssl=1\" alt=\"unicode_art.jpg\" \/> text strings include special characters which were used to control text representation: e.g. newline (ASCII 10) and carriage return (ASCII 13).\n\nThese characters are represented by a backward slash <code>\\<\/code> followed by\n<ol class=\"org-ol\">\n \t<li>a character e.g. newline is <code>\\n<\/code> and carriage return is <code>\\r<\/code><\/li>\n \t<li>a three digit octal number representing an ASCII character e.g. <code>\\012<\/code><\/li>\n \t<li>a two digit hexadecimal number e.g. <code>\\x0A<\/code><\/li>\n \t<li>an unicode number below 0x10000 <code>\\u000A<\/code>, \u2192 <code>\\u2192<\/code><\/li>\n \t<li>a 32 bit unicode number <code>\\U0000000A<\/code>, \u2192 <code>\\U00002192<\/code><\/li>\n \t<li>a unicode name <code>\"\\N{RIGHTWARDS ARROW}\"<\/code><\/li>\n<\/ol>\nsome printable character may require escape:\n<ol class=\"org-ol\">\n \t<li>the forward slash itself <code>\\\\<\/code><\/li>\n \t<li>quotes when identical with the surrounding quotes <code>\\'<\/code> and <code>\\\"<\/code><\/li>\n<\/ol>\nSee more details also <a href=\"https:\/\/en.wikipedia.org\/wiki\/Escape_sequences_in_C\" data-bcup-haslogintext=\"no\">here<\/a>\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org8a65f9c\" class=\"outline-3\">\n<h3 id=\"org8a65f9c\">Raw strings<\/h3>\n<div id=\"text-org8a65f9c\" class=\"outline-text-3\">\n\nby prefixing the letter <code>r<\/code> to the first quote, escaping characters will be ignored and treated literally: these are called raw strings\n\nForward slash appear in a couple of situation:\n<ol class=\"org-ol\">\n \t<li>in windows paths (here I will suggest better options later) e.g. <code>c:\\TEMP<\/code><\/li>\n \t<li>in regular expressions character classes e.g. <code>\\d<\/code> the class of digit characters<\/li>\n<\/ol>\nIn this case raw strings can be helpful\n\n<\/div>\n<\/div>\n<div id=\"outline-container-orgc99734f\" class=\"outline-3\">\n<h3 id=\"orgc99734f\">Binary strings<\/h3>\n<div id=\"text-orgc99734f\" class=\"outline-text-3\">\n\nBy prefixing a quote with the <code>b<\/code> letter the string will be interpreted as a binary sequence.\n\nThis is useful when\n<ul class=\"org-ul\">\n \t<li>reading or writing to an external device, possibly connected through a serial<\/li>\n \t<li>reading or writing binary files<\/li>\n<\/ul>\ne.g. the following 4 bytes are the \u201cmagic number\u201d at the beginning of java class file format\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\">b<span style=\"color: #98be65;\">\"<\/span><span style=\"color: #a9a1e1;\">\\xCA\\xFE\\xBA\\xBE<\/span><span style=\"color: #98be65;\">\"<\/span>\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org33d2c3b\" class=\"outline-3\">\n<h3 id=\"org33d2c3b\">Operators on strings<\/h3>\n<div id=\"text-org33d2c3b\" class=\"outline-text-3\">\n\nstrings can use sum and multiplication as following\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #83898d;\">\"hello \"<\/span> + <span style=\"color: #83898d;\">\"world\"<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields hello world<\/span>\n<span style=\"color: #83898d;\">\"hello \"<\/span> * <span style=\"color: #da8548; font-weight: bold;\">3<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields \"hello hello hello \"<\/span>\n<\/pre>\n<\/div>\nI will introduce more operators and activities on strings later\n\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org17ba8ff\" class=\"outline-2\">\n<h2 id=\"org17ba8ff\">Booleans and None<\/h2>\n<div id=\"text-org17ba8ff\" class=\"outline-text-2\">\n\nthere are a couple of predefined data types with a limited number of values which play a fundamental role in python\n\n<\/div>\n<div id=\"outline-container-org0b218cf\" class=\"outline-3\">\n<h3 id=\"org0b218cf\">None<\/h3>\n<div id=\"text-org0b218cf\" class=\"outline-text-3\">\n\nthe None type contains just the <code>None<\/code> value\n\nThis can be seen as an equivalent of a NULL pointer, its actual usage will be shown later\n\n<\/div>\n<\/div>\n<div id=\"outline-container-org867297f\" class=\"outline-3\">\n<h3 id=\"org867297f\">Boolean values and operators<\/h3>\n<div id=\"text-org867297f\" class=\"outline-text-3\">\n\nBoolean type has exactly two values, boolean shortcut operators are written as words and have the usual precedence rules\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #a9a1e1;\">True<\/span>\n<span style=\"color: #a9a1e1;\">False<\/span>\n<span style=\"color: #a9a1e1;\">True<\/span> <span style=\"color: #51afef;\">and<\/span> <span style=\"color: #a9a1e1;\">False<\/span>\n<span style=\"color: #a9a1e1;\">True<\/span> <span style=\"color: #51afef;\">or<\/span> <span style=\"color: #a9a1e1;\">False<\/span>\n<span style=\"color: #51afef;\">not<\/span> <span style=\"color: #a9a1e1;\">True<\/span>\n<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"outline-container-org926d1ae\" class=\"outline-3\">\n<h3 id=\"org926d1ae\">Triple operator and truth values<\/h3>\n<div id=\"text-org926d1ae\" class=\"outline-text-3\">\n\nthe triple operator is composed of\n<ul class=\"org-ul\">\n \t<li>the value to be returned if the clause is true<\/li>\n \t<li>the boolean clause<\/li>\n \t<li>the value to be returned if the clause is false<\/li>\n<\/ul>\n<div class=\"org-src-container\"><label class=\"org-src-name\"><\/label>\n<pre id=\"nil\" class=\"src src-python\"><span style=\"color: #83898d;\">\"there is sunshine\"<\/span> <span style=\"color: #51afef;\">if<\/span> <span style=\"color: #a9a1e1;\">True<\/span> <span style=\"color: #51afef;\">else<\/span> <span style=\"color: #83898d;\">\"it rains\"<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">returns \"there is sunshine\"<\/span>\n-<span style=\"color: #da8548; font-weight: bold;\">1<\/span> <span style=\"color: #51afef;\">if<\/span> <span style=\"color: #a9a1e1;\">False<\/span> <span style=\"color: #51afef;\">else<\/span> <span style=\"color: #da8548; font-weight: bold;\">42<\/span> <span style=\"color: #5b6268;\"># <\/span><span style=\"color: #5b6268;\">yields 42<\/span>\n<\/pre>\n<\/div>\nthe clause may contain also non boolean values (a deprecated practice)\n\nIn python the following objects are false\n<table border=\"2\" frame=\"hsides\" rules=\"groups\" cellspacing=\"0\" cellpadding=\"6\"><colgroup> <col class=\"org-left\" \/> <col class=\"org-left\" \/> <\/colgroup>\n<tbody>\n<tr>\n<td class=\"org-left\">0<\/td>\n<td class=\"org-left\">integer or floating point number 0<\/td>\n<\/tr>\n<tr>\n<td class=\"org-left\">None<\/td>\n<td class=\"org-left\">the None object<\/td>\n<\/tr>\n<tr>\n<td class=\"org-left\">\u201c\u201d<\/td>\n<td class=\"org-left\">the empty string<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\nI will add more falsy values later. In contrast the following objects are considered \u201cTrue\u201d\n<table border=\"2\" frame=\"hsides\" rules=\"groups\" cellspacing=\"0\" cellpadding=\"6\"><colgroup> <col class=\"org-right\" \/> <col class=\"org-left\" \/> <\/colgroup>\n<tbody>\n<tr>\n<td class=\"org-right\">1<\/td>\n<td class=\"org-left\">any integer, float or complex number different from 0<\/td>\n<\/tr>\n<tr>\n<td class=\"org-right\">\u201chi\u201d<\/td>\n<td class=\"org-left\">any non-empty string<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\nI don\u2019t recommend using this way to evaluate clauses as they may be less readable.\n\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"how are values created in the source code of python, how to create basic expressions and use basic containers","protected":false},"author":1,"featured_media":385,"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-149","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: literals, values, operators and expressions - 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\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python tutorial: literals, values, operators and expressions - Noise On The Net\" \/>\n<meta property=\"og:description\" content=\"how are values created in the source code of python, how to create basic expressions and use basic containers\" \/>\n<meta property=\"og:url\" content=\"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/\" \/>\n<meta property=\"og:site_name\" content=\"Noise On The Net\" \/>\n<meta property=\"article:published_time\" content=\"2022-11-20T19:06:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-30T21:23:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"829\" \/>\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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/\"},\"author\":{\"name\":\"marco.p.v.vezzoli\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"headline\":\"Python tutorial: literals, values, operators and expressions\",\"datePublished\":\"2022-11-20T19:06:00+00:00\",\"dateModified\":\"2024-03-30T21:23:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/\"},\"wordCount\":766,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#\\\/schema\\\/person\\\/88c3a70f2b23480197bc61d6e1e2e982\"},\"image\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1\",\"keywords\":[\"Python\"],\"articleSection\":[\"Language learning\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/\",\"url\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/\",\"name\":\"Python tutorial: literals, values, operators and expressions - Noise On The Net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1\",\"datePublished\":\"2022-11-20T19:06:00+00:00\",\"dateModified\":\"2024-03-30T21:23:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/noiseonthenet.space\\\/noise\\\/wp-content\\\/uploads\\\/2024\\\/03\\\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1\",\"width\":1200,\"height\":829},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/2022\\\/11\\\/python-tutorial-literals-values-operators-and-expressions\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/noiseonthenet.space\\\/noise\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python tutorial: literals, values, operators and expressions\"}]},{\"@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: literals, values, operators and expressions - 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\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/","og_locale":"en_US","og_type":"article","og_title":"Python tutorial: literals, values, operators and expressions - Noise On The Net","og_description":"how are values created in the source code of python, how to create basic expressions and use basic containers","og_url":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/","og_site_name":"Noise On The Net","article_published_time":"2022-11-20T19:06:00+00:00","article_modified_time":"2024-03-30T21:23:59+00:00","og_image":[{"width":1200,"height":829,"url":"https:\/\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#article","isPartOf":{"@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/"},"author":{"name":"marco.p.v.vezzoli","@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"headline":"Python tutorial: literals, values, operators and expressions","datePublished":"2022-11-20T19:06:00+00:00","dateModified":"2024-03-30T21:23:59+00:00","mainEntityOfPage":{"@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/"},"wordCount":766,"commentCount":0,"publisher":{"@id":"https:\/\/noiseonthenet.space\/noise\/#\/schema\/person\/88c3a70f2b23480197bc61d6e1e2e982"},"image":{"@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1","keywords":["Python"],"articleSection":["Language learning"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/","url":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/","name":"Python tutorial: literals, values, operators and expressions - Noise On The Net","isPartOf":{"@id":"https:\/\/noiseonthenet.space\/noise\/#website"},"primaryImageOfPage":{"@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#primaryimage"},"image":{"@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1","datePublished":"2022-11-20T19:06:00+00:00","dateModified":"2024-03-30T21:23:59+00:00","breadcrumb":{"@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#primaryimage","url":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1","contentUrl":"https:\/\/i0.wp.com\/noiseonthenet.space\/noise\/wp-content\/uploads\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1","width":1200,"height":829},{"@type":"BreadcrumbList","@id":"https:\/\/noiseonthenet.space\/noise\/2022\/11\/python-tutorial-literals-values-operators-and-expressions\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/noiseonthenet.space\/noise\/"},{"@type":"ListItem","position":2,"name":"Python tutorial: literals, values, operators and expressions"}]},{"@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\/2024\/03\/david-clode-5uU8HSpfwkI-unsplash-reduced-2.jpg?fit=1200%2C829&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pdDUZ5-2p","jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/149","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=149"}],"version-history":[{"count":6,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/149\/revisions"}],"predecessor-version":[{"id":388,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/posts\/149\/revisions\/388"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/media\/385"}],"wp:attachment":[{"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/media?parent=149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/categories?post=149"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/noiseonthenet.space\/noise\/wp-json\/wp\/v2\/tags?post=149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}