{"id":2878,"date":"2022-06-16T14:39:55","date_gmt":"2022-06-16T13:39:55","guid":{"rendered":"https:\/\/hub.salford.ac.uk\/psytech\/?page_id=2878"},"modified":"2022-06-28T10:08:43","modified_gmt":"2022-06-28T09:08:43","slug":"getting-started-python","status":"publish","type":"page","link":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/","title":{"rendered":"Getting Started &#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<p>Python in itself is a very friendly programming language, when we get to grips with writing code, once you grasp the logic, it will become very intuitive. Before we get hands-on with code, it&#8217;s useful to invest some time in learning more widely about Python. Let&#8217;s list off some key features of Python, to begin with.<\/p>\n\n\n\n<p>Python is primarily an <strong>Object-Oriented Programming (OOP) <\/strong>language. OOP is a programming paradigm that organises itself around objects, rather than functions or logic. Don&#8217;t worry too much about what this means at this stage. Although if you start learning to program in other languages then it&#8217;s worth remembering. <\/p>\n\n\n\n<p>Python is a <strong>&#8220;high-level&#8221; language<\/strong>, which means it&#8217;s more easily understood by humans. Since python is a high-level language, the computer has to interpret the code into a language the computer understands, which is machine code. <\/p>\n\n\n\n<p>Coming from a psychology background, we reference research articles and use APA style formatting. Well, Python also has a style guide, called <strong>PEP 8<\/strong> (<a href=\"https:\/\/peps.python.org\/pep-0008\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/peps.python.org\/pep-0008\/<\/a>). It&#8217;s certainly good practice to get into the habit of having good style. Although, don&#8217;t stress too much about this as a beginner, what&#8217;s important to learn is the <strong>syntax<\/strong>. <\/p>\n\n\n\n<p>Like natural languages, programming languages have <strong>syntax<\/strong>. The syntax is a set of rules that you must follow to ensure your code can be interpreted by the computer. If your syntax is not correct, when you try to run your code, you will receive an error. Don&#8217;t be scared of errors, when programming you&#8217;re going to come across a lot of them. <\/p>\n\n\n\n<p>To write any python code, we&#8217;re going to need a code editor or <strong>Integrated Development Environment, IDE<\/strong> for short. My personal favourite IDE is one called Spyder. If you&#8217;re wanting to run code then this is the bare basics of what you need. However, as you get more advanced with your coding, you may wish to add libraries to your code, in which case I recommend using Anaconda. Anaconda is a distributor that you can install which installs your IDE for you and manages libraries. Don&#8217;t worry if you find this confusing to begin with, it&#8217;ll make more sense as you learn more. For now, all you need to know is that we&#8217;re going to be opening Anaconda and using Spyder through Anaconda. <\/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\"><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-12-1024x1024.png\" alt=\"\" class=\"wp-image-2886\" width=\"163\" height=\"163\" srcset=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-12-1024x1024.png 1024w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-12-300x300.png 300w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-12-150x150.png 150w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-12-768x768.png 768w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-12.png 1200w\" sizes=\"auto, (max-width: 163px) 100vw, 163px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-13.png\" alt=\"\" class=\"wp-image-2887\" width=\"282\" height=\"140\" srcset=\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-13.png 447w, https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-13-300x150.png 300w\" sizes=\"auto, (max-width: 282px) 100vw, 282px\" \/><\/figure>\n<\/div><\/div>\n<\/div>\n\n\n\n<p>Please see Anaconda&#8217;s website for installation information: <a href=\"https:\/\/docs.anaconda.com\/anaconda\/install\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.anaconda.com\/anaconda\/install\/<\/a>.<\/p>\n\n\n\n<p>Note to create a new environment in Anaconda so we&#8217;re <strong>not <\/strong>using the base (root).<\/p>\n\n\n\n<p>Talk through the editor, console &amp; inspector&#8230; <\/p>\n\n\n\n<p>A lot about programming is problem-solving and there is no way you&#8217;re going to remember every function. You&#8217;re going to have to get used to looking things up, my favourite resource for python knowledge is https:\/\/www.w3schools.com\/python<\/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>Python in itself is a very friendly programming language, when we get to grips with writing code, once you grasp the logic, it will become very intuitive. Before we get hands-on with code, it&#8217;s useful to invest some time in learning more widely about Python. Let&#8217;s list off some key features of Python, to begin [&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-2878","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>Getting Started - 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\/getting-started-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting Started - Python - Salford PsyTech Home \u2192\u2302\" \/>\n<meta property=\"og:description\" content=\"Python in itself is a very friendly programming language, when we get to grips with writing code, once you grasp the logic, it will become very intuitive. Before we get hands-on with code, it&#8217;s useful to invest some time in learning more widely about Python. Let&#8217;s list off some key features of Python, to begin [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/\" \/>\n<meta property=\"og:site_name\" content=\"Salford PsyTech Home \u2192\u2302\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-28T09:08:43+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=\"3 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\/getting-started-python\/\",\"url\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/\",\"name\":\"Getting Started - Python - Salford PsyTech Home \u2192\u2302\",\"isPartOf\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png\",\"datePublished\":\"2022-06-16T13:39:55+00:00\",\"dateModified\":\"2022-06-28T09:08:43+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-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\/getting-started-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\":\"Getting Started &#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":"Getting Started - 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\/getting-started-python\/","og_locale":"en_US","og_type":"article","og_title":"Getting Started - Python - Salford PsyTech Home \u2192\u2302","og_description":"Python in itself is a very friendly programming language, when we get to grips with writing code, once you grasp the logic, it will become very intuitive. Before we get hands-on with code, it&#8217;s useful to invest some time in learning more widely about Python. Let&#8217;s list off some key features of Python, to begin [&hellip;]","og_url":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/","og_site_name":"Salford PsyTech Home \u2192\u2302","article_modified_time":"2022-06-28T09:08:43+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":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/","url":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/","name":"Getting Started - Python - Salford PsyTech Home \u2192\u2302","isPartOf":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/#website"},"primaryImageOfPage":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/#primaryimage"},"image":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/#primaryimage"},"thumbnailUrl":"https:\/\/hub.salford.ac.uk\/psytech\/wp-content\/uploads\/sites\/95\/2022\/06\/image-11-1024x1024.png","datePublished":"2022-06-16T13:39:55+00:00","dateModified":"2022-06-28T09:08:43+00:00","breadcrumb":{"@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hub.salford.ac.uk\/psytech\/python\/getting-started-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\/getting-started-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":"Getting Started &#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\/2878","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=2878"}],"version-history":[{"count":11,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages\/2878\/revisions"}],"predecessor-version":[{"id":3081,"href":"https:\/\/hub.salford.ac.uk\/psytech\/wp-json\/wp\/v2\/pages\/2878\/revisions\/3081"}],"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=2878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}