{"id":56,"date":"2024-02-14T19:00:01","date_gmt":"2024-02-14T19:00:01","guid":{"rendered":"https:\/\/mrcoder701.com\/?p=56"},"modified":"2024-02-27T21:43:58","modified_gmt":"2024-02-27T16:13:58","slug":"the-walrus-operator-in-python","status":"publish","type":"post","link":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/","title":{"rendered":"The Walrus Operator (:=) in Python"},"content":{"rendered":"

In this post we\u2019ll have a look at Python\u2019s walrus operator (:=<\/code>), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.<\/p>

Python is a popular programming language known for its simplicity, flexibility, and ease of use. In version 3.8, Python introduced the Walrus Operator (:=), a new feature that allows you to assign values to variables within an expression. This operator is a relatively new addition to the language, and it has quickly become popular among Python developers. In this blog post, we\u2019ll explore the Walrus Operator in Python and see how it can be used to write more concise and readable code.<\/p>

What is the Walrus Operator (:=)?<\/strong><\/h2>

The Walrus Operator is a new syntax introduced in Python 3.8 that allows you to assign values to variables within an expression<\/mark>. Thi<\/mark>s is particularly useful when you want to use the value of a variable multiple times within the same expression<\/mark>.<\/mark> The Walrus Operator is denoted by the := symbol.<\/p>

Example 1: Simple Walrus Operator Example<\/strong>:<\/a><\/p>

x = 10\nif (y := x + 5) > 10:\n    print(\"y is greater than 10\")\nelse:\n    print(\"y is less than or equal to 10\")\n<\/code><\/pre>

In this example, we use the Walrus Operator to assign the value of x + 5 to y within the if statement. If y is greater than 10, we print \u201cy is greater than 10,\u201d and if it\u2019s less than or equal to 10, we print \u201cy is less than or equal to 10.\u201d<\/p>

Example 2: Walrus Operator in a While Loop<\/h2>
import random\n\nwhile (n := random.randint(0, 10)) != 5:\n    print(n)\n\nprint(\"Found it!\")<\/code><\/pre>

In this example, we use the Walrus Operator to assign a random integer between 0 and 10 to the variable n and immediately check whether it is equal to 5. The loop will continue until n is equal to 5, at which point the loop will exit and \u201cFound it!\u201d will be printed.<\/p>

Example 3: Walrus Operator in List Comprehension<\/strong><\/h2>
lst = [1, 2, 3, 4, 5]\nnew_lst = [x for x in lst if (x_squared := x**2) > 10]\n\nprint(new_lst)<\/code><\/pre>

In this example, we use the Walrus Operator in a list comprehension to create a new list containing only the elements of lst whose squared value is greater than 10. The squared value of each element is assigned to the variable x_squared within the expression.<\/p>

Example 4: Walrus Operator with Function Return Value<\/h2>
def calculate_sum(lst):\n    if (n := len(lst)) > 0:\n        return sum(lst) \/ n\n    else:\n        return 0\n\nlst = [1, 2, 3, 4, 5]\navg = calculate_sum(lst)\n\nprint(avg)<\/code><\/pre>

In this example, we use the Walrus Operator to assign the length of the list lst to the variable n within the if statement. We then return the average of the list if its length is greater than 0, and 0 otherwise.<\/p>

Conclusion:<\/h2>

The Walrus Operator is a powerful new feature in Python that allows you to write more concise and readable code. It can be used in a variety of situations, such as in if statements, while loops, list comprehensions, and function return values. However, it\u2019s important to use the Walrus Operator in a way that improves the clarity and readability of your code, rather than just for the sake of using a new feature.<\/p>

Thanks for following and claps <\/strong><\/p>

Let\u2019s Get in Touch! Follow me on:<\/p>

>GitHub: @gajanan0707<\/a><\/p>

>Linkedin: Gajanan Rajput<\/a><\/p>

>Medium: https:\/\/medium.com\/@rajputgajanan50<\/a><\/p>","protected":false},"excerpt":{"rendered":"

In this post we’ll have a look at Python’s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more…<\/p>\n","protected":false},"author":2,"featured_media":275,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,16],"tags":[20,21,18,19,36,52,32,31,70],"class_list":["post-56","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming","category-python","tag-google","tag-medium","tag-python","tag-python3","tag-django","tag-flask","tag-programmingtips","tag-pythondev","tag-walrus"],"yoast_head":"\nThe Walrus Operator (:=) in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣<\/title>\n<meta name=\"description\" content=\"In this post we\u2019ll have a look at Python\u2019s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Walrus Operator (:=) in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣\" \/>\n<meta property=\"og:description\" content=\"In this post we\u2019ll have a look at Python\u2019s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"🌟Code with MrCoder7️⃣0️⃣1️⃣\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-14T19:00:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-27T16:13:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2240\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"mr.coder\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"mr.coder\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\"},\"author\":{\"name\":\"mr.coder\",\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\"},\"headline\":\"The Walrus Operator (:=) in Python\",\"datePublished\":\"2024-02-14T19:00:01+00:00\",\"dateModified\":\"2024-02-27T16:13:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\"},\"wordCount\":506,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\"},\"image\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png\",\"keywords\":[\"#google\",\"#medium\",\"#python\",\"#python3\",\"Django\",\"flask\",\"ProgrammingTips\",\"PythonDev\",\"walrus\"],\"articleSection\":[\"Programming\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\",\"url\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\",\"name\":\"The Walrus Operator (:=) in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣\",\"isPartOf\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png\",\"datePublished\":\"2024-02-14T19:00:01+00:00\",\"dateModified\":\"2024-02-27T16:13:58+00:00\",\"description\":\"In this post we\u2019ll have a look at Python\u2019s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage\",\"url\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png\",\"contentUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png\",\"width\":2240,\"height\":1260},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.mrcoder701.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Walrus Operator (:=) in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.mrcoder701.com\/#website\",\"url\":\"https:\/\/www.mrcoder701.com\/\",\"name\":\"Blog With MrCoder701\",\"description\":\"Blog related to programming\",\"publisher\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.mrcoder701.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d\",\"name\":\"mr.coder\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png\",\"contentUrl\":\"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png\",\"width\":500,\"height\":500,\"caption\":\"mr.coder\"},\"logo\":{\"@id\":\"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/mrcoder701.com\",\"https:\/\/www.instagram.com\/mr_coder_701\/\",\"https:\/\/www.youtube.com\/@mrcoder701\"],\"url\":\"https:\/\/www.mrcoder701.com\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Walrus Operator (:=) in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣","description":"In this post we\u2019ll have a look at Python\u2019s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.","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:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/","og_locale":"en_US","og_type":"article","og_title":"The Walrus Operator (:=) in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣","og_description":"In this post we\u2019ll have a look at Python\u2019s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.","og_url":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/","og_site_name":"🌟Code with MrCoder7️⃣0️⃣1️⃣","article_published_time":"2024-02-14T19:00:01+00:00","article_modified_time":"2024-02-27T16:13:58+00:00","og_image":[{"width":2240,"height":1260,"url":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png","type":"image\/png"}],"author":"mr.coder","twitter_card":"summary_large_image","twitter_misc":{"Written by":"mr.coder","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#article","isPartOf":{"@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/"},"author":{"name":"mr.coder","@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d"},"headline":"The Walrus Operator (:=) in Python","datePublished":"2024-02-14T19:00:01+00:00","dateModified":"2024-02-27T16:13:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/"},"wordCount":506,"commentCount":1,"publisher":{"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d"},"image":{"@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png","keywords":["#google","#medium","#python","#python3","Django","flask","ProgrammingTips","PythonDev","walrus"],"articleSection":["Programming","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/","url":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/","name":"The Walrus Operator (:=) in Python - 🌟Code with MrCoder7️⃣0️⃣1️⃣","isPartOf":{"@id":"https:\/\/www.mrcoder701.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage"},"image":{"@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png","datePublished":"2024-02-14T19:00:01+00:00","dateModified":"2024-02-27T16:13:58+00:00","description":"In this post we\u2019ll have a look at Python\u2019s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more readable code, or save compute.","breadcrumb":{"@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#primaryimage","url":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png","contentUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png","width":2240,"height":1260},{"@type":"BreadcrumbList","@id":"https:\/\/www.mrcoder701.com\/2024\/02\/14\/the-walrus-operator-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.mrcoder701.com\/"},{"@type":"ListItem","position":2,"name":"The Walrus Operator (:=) in Python"}]},{"@type":"WebSite","@id":"https:\/\/www.mrcoder701.com\/#website","url":"https:\/\/www.mrcoder701.com\/","name":"Blog With MrCoder701","description":"Blog related to programming","publisher":{"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.mrcoder701.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/ba1cd6b2ad26df384b1a655341eaef5d","name":"mr.coder","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/","url":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png","contentUrl":"https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/06\/369B947D-A5EE-4B16-816A-5EE55D1DDF96_L0_001-10_6_2024-6-13-24-PM.png","width":500,"height":500,"caption":"mr.coder"},"logo":{"@id":"https:\/\/www.mrcoder701.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/mrcoder701.com","https:\/\/www.instagram.com\/mr_coder_701\/","https:\/\/www.youtube.com\/@mrcoder701"],"url":"https:\/\/www.mrcoder701.com\/author\/admin\/"}]}},"rttpg_featured_image_url":{"full":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png",2240,1260,false],"landscape":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png",2240,1260,false],"portraits":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png",2240,1260,false],"thumbnail":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-150x150.png",150,150,true],"medium":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-300x169.png",300,169,true],"large":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-1024x576.png",1024,576,true],"1536x1536":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-1536x864.png",1536,864,true],"2048x2048":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-2048x1152.png",2048,1152,true],"woocommerce_thumbnail":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-300x300.png",300,300,true],"woocommerce_single":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2.png",600,338,false],"woocommerce_gallery_thumbnail":["https:\/\/www.mrcoder701.com\/wp-content\/uploads\/2024\/02\/Dark-Grey-How-to-Start-a-Nonprofit-Coffee-Shop-Blog-Banner-2-150x150.png",150,150,true]},"rttpg_author":{"display_name":"mr.coder","author_link":"https:\/\/www.mrcoder701.com\/author\/admin\/"},"rttpg_comment":1,"rttpg_category":"<a href=\"https:\/\/www.mrcoder701.com\/category\/programming\/\" rel=\"category tag\">Programming<\/a> <a href=\"https:\/\/www.mrcoder701.com\/category\/python\/\" rel=\"category tag\">Python<\/a>","rttpg_excerpt":"In this post we’ll have a look at Python’s walrus operator (:=), which can be used to assign and return a value in one expression. This can sometimes lead to shorter and more…","_links":{"self":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts\/56","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/comments?post=56"}],"version-history":[{"count":11,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts\/56\/revisions"}],"predecessor-version":[{"id":320,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/posts\/56\/revisions\/320"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/media\/275"}],"wp:attachment":[{"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/media?parent=56"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/categories?post=56"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mrcoder701.com\/wp-json\/wp\/v2\/tags?post=56"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}