{"id":2941,"date":"2022-06-17T10:13:23","date_gmt":"2022-06-17T09:13:23","guid":{"rendered":"https:\/\/hub.salford.ac.uk\/psytech\/?page_id=2941"},"modified":"2022-07-19T10:36:54","modified_gmt":"2022-07-19T09:36:54","slug":"operators-conditionals-python","status":"publish","type":"page","link":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/","title":{"rendered":"Operators &amp; Conditionals &#8211; Python"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png\" alt=\"\" class=\"wp-image-2880\" width=\"247\" height=\"247\" srcset=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png 1024w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-300x300.png 300w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-150x150.png 150w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-768x768.png 768w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11.png 1200w\" sizes=\"auto, (max-width: 247px) 100vw, 247px\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Operators<\/h2>\n\n\n\n<p>In the last lesson, you were introduced to the idea that you can do arithmetic in python. Let&#8217;s explore that some more. Look at the code below to see some arithmetic operators, feel free to play around with the code below<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = 10  #Feel free to change this\ny = 5  #Again, feel free to change\n\nprint(x+y) #Addition\nprint(x-y) #Substraction\nprint(x*y) #Multiplication\nprint(x\/y) #Division\nprint(x%y) #Modulus\nprint(x**y) #Exponentiation\nprint(x\/\/y) #Floor division<\/code><\/pre>\n\n\n\n<p>Much like when we assign a value using the equal = operator, we have other ways of assigning values. For example.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = 10 #We assign x the value of ten\n\nx += 5 #Here we now assigning x the value of x + 5. \n\nprint(x) #This will print the NEW value of x which is 15.<\/code><\/pre>\n\n\n\n<p>The same logic applies to the other arithmetic operators. Ensure you&#8217;re putting the arithmetic operator first followed by the equal = assignment operator with no spaces. Give it a try with the rest.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">More operators by now we&#8217;re using them with conditionals.<\/h2>\n\n\n\n<p>So it&#8217;s cool we can use arithmetic operators, and it&#8217;s also cool we can combine the arithmetic operators with the assignment operator. <\/p>\n\n\n\n<p>Now there are going to be times when we only want the code to do something <strong>if <\/strong>a condition is met. Let&#8217;s say we only want to run the code if the variable x is bigger than the variable y. Here is how that would look.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>x = 10 \ny = 5\n\nif x &gt; y: #note the if statement and colon\n  print(\"x is greater than y\") #note the indentation\n  \nprint(\"The code is done now.\")<\/code><\/pre>\n\n\n\n<p>The above code points out the if statement, colon, and indentation. In python the word if is a keyword. Keywords have a reserved meaning in the python language, so do not use them as variable names. The if statement pretty much does as you&#8217;d expect, if something is true or false do something. Wait, it&#8217;s the true or false idea something we&#8217;ve heard before? Yes, it is! It&#8217;s known as boolean logic. What about the colon and indentation, well that is ensuring you have the correct syntax for your code to run. Let&#8217;s say we make the variable y bigger than variable x, what do you think would happen? If you guessed that the indented part of the code doesn&#8217;t run then you&#8217;d be right. Give this concept a try with the other <strong>comparison operators.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Comparison operator<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td>==<\/td><td>The same as<\/td><\/tr><tr><td>!=<\/td><td>Not the same as<\/td><\/tr><tr><td>&gt;<\/td><td>Greater than<\/td><\/tr><tr><td>&lt;<\/td><td>Less than<\/td><\/tr><tr><td>&gt;=<\/td><td>Greater than or equal to<\/td><\/tr><tr><td>&lt;=<\/td><td>Less than or equal to<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>All of the comparison operators can handle floats and integers. However, not all of the comparison operators can work with strings. You can only use the same as == and not the same as != comparison operators with strings. Although, that&#8217;s all we need if we can to make a simple quiz. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Quiz time: What is the surname of the researcher who is known for The Strange Situation? Write your answer...\")\n\nanswer = input() \n\nif answer == \"Ainsworth\":\n    print(\"This is correct!\")\n   \nprint(\"The quiz is over.\")<\/code><\/pre>\n\n\n\n<p>The quiz asks, what is the surname of the researcher who is known for The Strange Situation? The correct answer the quiz program is looking for is Ainsworth. However, if the user inputs the wrong answer, then it doesn&#8217;t tell them. Let&#8217;s fix that using an else statement.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Quiz time: What is the surname of the researcher who is known for The Strange Situation? Write your answer...\")\n\nanswer = input()\n\nif answer == \"Ainsworth\":\n    print(\"This is correct!\")\nelse:              #note how this is aligned with the if statement that came prior \n    print(\"This is incorrect.\") #again for else statments we intend \n                                #what we want to happen\n    \nprint(\"The quiz is over.\")<\/code><\/pre>\n\n\n\n<p>The else statement is a catch-all, which runs if any previous conditions are not met. Now, we don&#8217;t always want to sort into two groups. What if someone confuses Ainsworth&#8217;s work with another popular psychologist at the time, such as Bowlby. We can let them know that they are close. Well, we can do this using an elif statement. The elif statement goes between the if and the else statement and says if the previous conditions aren&#8217;t met, try this one. Let&#8217;s try it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"Quiz time: What is the surname of the researcher who known for The Strange Situation? Write your answer...\")\n\nanswer = input()\n\nif answer == \"Ainsworth\":\n    print(\"This is correct!\")\nelif answer == \"Bowlby\": #Don't forget the colon!\n    print(\"Incorrect. Bowlby, is an attachment theorist but he did not develop the strange situation! \") #Don't forget the indentation\nelse: \n    print(\"This is incorrect.\") \n                                \n    \nprint(\"The quiz is over.\")<\/code><\/pre>\n\n\n\n<p>Take some time to play around with this idea! Try creating something that uses the not the same as operator !=.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Multiple Conditions!<\/h2>\n\n\n\n<p>Let&#8217;s say we only want to execute some code if two conditions are met. We&#8217;ll go with the scenario where we&#8217;re screening participants for a research project. In order to be eligible to participate, they have to be 18 or over <strong>and <\/strong>they have to be right-handed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"We'd like to ask you some questions to see if you're a suitable participant.\")\n\nprint(\"Please enter using the keypad your age\")\nage = int(input())\n\nprint(\"Are you right handed? Please indicate by typing Yes or No\")\nhand = input()\n\nif age &gt;= 18 and hand == \"Yes\": \n    print(\"Great, you're eligible to take part!\")\nelse: \n    print(\"unfortunately, you're not eligible to take part\") \n                                \n    \nprint(\"End of questions.\")<\/code><\/pre>\n\n\n\n<p>You can see above that you can use the <strong>and operator <\/strong>to specify that two conditions must be met in order for the following indented code to run. Python also has an <strong>or operator<\/strong> that can be used in the same way the <strong>and operator <\/strong>is used. The or operator runs the following indented code if one or the other conditions is met. Using an <strong>elif statement<\/strong> and the <strong>or operator<\/strong>, I&#8217;d like you to add a condition that will tell the user they only meet one of the conditions.<\/p>\n\n\n\n<div class=\"wp-block-pb-accordion-item c-accordion__item js-accordion-item no-js\" data-initially-open=\"false\" data-click-to-close=\"true\" data-auto-close=\"true\" data-scroll=\"false\" data-scroll-offset=\"0\"><h3 id=\"at-29410\" class=\"c-accordion__title js-accordion-controller\" role=\"button\">Click to reveal \u2193<\/h3><div id=\"ac-29410\" class=\"c-accordion__content\">\n<p>Don&#8217;t worry if your answer is slightly different, there are many ways to achieve the same thing!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"We'd like to ask you some questions to see if you're a suitable participant.\")\n\nprint(\"Please enter using the keypad your age\")\nage = int(input())\n\nprint(\"Are you right handed? Please indicate by typing Yes or No\")\nhand = input()\n\nif age &gt;= 18 and hand == \"Yes\": \n    print(\"Great, you're eligible to take part!\")\nelif age &gt; 18 or hand == \"Yes\":\n    print(\"Unfortunately you don't meet both of the requirements.\")\nelse: \n    print(\"unfortunately, you're not eligible to take part\") \n                                \n    \nprint(\"End of questions.\")<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Challenge!<\/h2>\n\n\n\n<p> For the program above, I&#8217;d like you to write some code. What I&#8217;d like the code to do is the following. If someone enters an age below 18 and they&#8217;re right-handed, I want the program to tell them how many years they have to wait to be old enough to participate.<\/p>\n\n\n\n<div class=\"wp-block-pb-accordion-item c-accordion__item js-accordion-item no-js\" data-initially-open=\"false\" data-click-to-close=\"true\" data-auto-close=\"true\" data-scroll=\"false\" data-scroll-offset=\"0\"><h3 id=\"at-29411\" class=\"c-accordion__title js-accordion-controller\" role=\"button\">Click to reveal \u2193<\/h3><div id=\"ac-29411\" class=\"c-accordion__content\">\n<p>Don&#8217;t worry if your answer is slightly different, there are many ways to achieve the same thing!<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>print(\"We'd like to ask you some questions to see if you're a suitable participant.\")\n\nprint(\"Please enter using the keypad your age\")\nage = int(input())\n\nprint(\"Are you right handed? Please indicate by typing Yes or No\")\nhand = input()\n\nif age &gt;= 18 and hand == \"Yes\": \n    print(\"Great, you're eligible to take part!\")\nelif age &gt; 18 or hand == \"Yes\":\n    print(\"Unfortunately you don't meet both of the requirments.\")\nelse: \n    print(\"Unfortunately, you're not eligible to take part\")      \n\n                           \nif age &lt; 18 and hand == \"Yes\": #I've put this is an entirely different\n                               #chain of if and else statments \n    remaining = 18 - age #This is where we calculate how many years\n    print(\"You have \", remaining, \"years until you're old enough to participate.\")    \n \nprint(\"End of questions.\")<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Add on:<\/h2>\n\n\n\n<p>What do you do if none of your conditions are met and you want the program to do nothing? If this occurs then you&#8217;d use a <strong>pass statement<\/strong>. The <strong>pass statement<\/strong> basically say, &#8220;do nothing!&#8221;, it&#8217;s a great placeholder since empty code isn&#8217;t allowed in if, elif, and else statements.<\/p>\n\n\n\n<p>In the next session, we&#8217;ll be covering loops!<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile\" style=\"grid-template-columns:17% auto\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"683\" height=\"1024\" src=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-683x1024.jpg\" alt=\"\" class=\"wp-image-3201 size-full\" srcset=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-683x1024.jpg 683w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-200x300.jpg 200w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-768x1152.jpg 768w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-1024x1536.jpg 1024w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-1365x2048.jpg 1365w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/08\/aaaPaige-Metcalf-scaled.jpg 1707w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<h4 class=\"has-text-align-left has-large-font-size wp-block-heading\">Course Author<\/h4>\n\n\n\n<hr class=\"wp-block-separator aligncenter has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-style:italic;font-weight:500\">Paige Metcalfe<br>c.p.metcalfe@salford.ac.uk<\/p>\n<\/div><\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Operators In the last lesson, you were introduced to the idea that you can do arithmetic in python. Let&#8217;s explore that some more. Look at the code below to see some arithmetic operators, feel free to play around with the code below Much like when we assign a value using the equal = operator, we [&hellip;]<\/p>\n","protected":false},"author":177,"featured_media":0,"parent":2877,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"footnotes":""},"class_list":["post-2941","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Operators &amp; Conditionals - Python - Salford PsyTech Home \u2192\u2302<\/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:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Operators &amp; Conditionals - Python - Salford PsyTech Home \u2192\u2302\" \/>\n<meta property=\"og:description\" content=\"Operators In the last lesson, you were introduced to the idea that you can do arithmetic in python. Let&#8217;s explore that some more. Look at the code below to see some arithmetic operators, feel free to play around with the code below Much like when we assign a value using the equal = operator, we [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Salford PsyTech Home \u2192\u2302\" \/>\n<meta property=\"article:modified_time\" content=\"2022-07-19T09:36:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/\",\"url\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/\",\"name\":\"Operators &amp; Conditionals - Python - Salford PsyTech Home \u2192\u2302\",\"isPartOf\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png\",\"datePublished\":\"2022-06-17T09:13:23+00:00\",\"dateModified\":\"2022-07-19T09:36:54+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#primaryimage\",\"url\":\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11.png\",\"contentUrl\":\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11.png\",\"width\":1200,\"height\":1200},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hub.salford.ac.uk\/psytech\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Operators &amp; Conditionals &#8211; Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#website\",\"url\":\"https:\/\/hub.salford.ac.uk\/psytech\/\",\"name\":\"Salford PsyTech Home\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hub.salford.ac.uk\/psytech\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#organization\",\"name\":\"Salford PsyTech Home\",\"url\":\"https:\/\/hub.salford.ac.uk\/psytech\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2025\/02\/university-salford-logo-400x250-1.png\",\"contentUrl\":\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2025\/02\/university-salford-logo-400x250-1.png\",\"width\":400,\"height\":250,\"caption\":\"Salford PsyTech Home\"},\"image\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Operators &amp; Conditionals - Python - Salford PsyTech Home \u2192\u2302","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:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/","og_locale":"en_US","og_type":"article","og_title":"Operators &amp; Conditionals - Python - Salford PsyTech Home \u2192\u2302","og_description":"Operators In the last lesson, you were introduced to the idea that you can do arithmetic in python. Let&#8217;s explore that some more. Look at the code below to see some arithmetic operators, feel free to play around with the code below Much like when we assign a value using the equal = operator, we [&hellip;]","og_url":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/","og_site_name":"Salford PsyTech Home \u2192\u2302","article_modified_time":"2022-07-19T09:36:54+00:00","og_image":[{"url":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/","url":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/","name":"Operators &amp; Conditionals - Python - Salford PsyTech Home \u2192\u2302","isPartOf":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#primaryimage"},"image":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#primaryimage"},"thumbnailUrl":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png","datePublished":"2022-06-17T09:13:23+00:00","dateModified":"2022-07-19T09:36:54+00:00","breadcrumb":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#primaryimage","url":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11.png","contentUrl":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11.png","width":1200,"height":1200},{"@type":"BreadcrumbList","@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/operators-conditionals-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hub.salford.ac.uk\/psytech\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/hub.salford.ac.uk\/psytech\/python\/"},{"@type":"ListItem","position":3,"name":"Operators &amp; Conditionals &#8211; Python"}]},{"@type":"WebSite","@id":"https:\/\/hub.salford.ac.uk\/psytech\/#website","url":"https:\/\/hub.salford.ac.uk\/psytech\/","name":"Salford PsyTech Home","description":"","publisher":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hub.salford.ac.uk\/psytech\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/hub.salford.ac.uk\/psytech\/#organization","name":"Salford PsyTech Home","url":"https:\/\/hub.salford.ac.uk\/psytech\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hub.salford.ac.uk\/psytech\/#\/schema\/logo\/image\/","url":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2025\/02\/university-salford-logo-400x250-1.png","contentUrl":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2025\/02\/university-salford-logo-400x250-1.png","width":400,"height":250,"caption":"Salford PsyTech Home"},"image":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages\/2941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/users\/177"}],"replies":[{"embeddable":true,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/comments?post=2941"}],"version-history":[{"count":7,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages\/2941\/revisions"}],"predecessor-version":[{"id":3103,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages\/2941\/revisions\/3103"}],"up":[{"embeddable":true,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages\/2877"}],"wp:attachment":[{"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/media?parent=2941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}