{"id":19085,"date":"2020-07-06T17:26:41","date_gmt":"2020-07-07T00:26:41","guid":{"rendered":"https:\/\/careerkarma.com\/blog\/?p=19085"},"modified":"2023-12-01T03:38:52","modified_gmt":"2023-12-01T11:38:52","slug":"python-class","status":"publish","type":"post","link":"https:\/\/careerkarma.com\/blog\/python-class\/","title":{"rendered":"Classes and Objects in Python for Beginners"},"content":{"rendered":"\n<p>Today we\u2019re going to be talking about classes. No, we don\u2019t mean school classes.<br><\/p>\n\n\n\n<p>In programming, classes have their own definition. A class is a blueprint created by a coder for an object. It defines the data that can be stored in an object and the methods which can be performed on that particular object.<br><\/p>\n\n\n\n<p>Python is an object-oriented programming language. This means that it uses a pattern of development where objects and classes are used to store data.<br><\/p>\n\n\n\n<p>The object-oriented approach helps reduce repetition in your code, which makes it easier to read and maintain your code. Classes and objects are a part of many programming languages, such as Java, Python, and C++.<br><\/p>\n\n\n\n<p>In this guide, we\u2019re going to discuss what classes are, how they work, and how you can declare one in Python. We\u2019ll walk through a few examples to help you along the way.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is a Class?<\/h2>\n\n\n\n<p>A class is a blueprint that you use to define an object.<br><\/p>\n\n\n\n<p>Imagine that you are looking at a blueprint for a house. That blueprint will outline where the doors will go, where windows will be placed, and so on. A class in programming is similar. A class provides a blueprint on the data that can be stored in an object.<br><\/p>\n\n\n\n<p>Classes are defined using the <code>class<\/code> keyword. Let\u2019s get started by defining a class called Player which has two functions:<br><\/p>\n\n\n\n<p>class Player:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>\"\"\" This is a class for a player \"\"\"\n\tname = \"Luke\"\n\tdef wield_sword(self):\n\t\tprint(\"You have wielded your sword.\")\n\tdef drink_health_potion(self):\n\t\tprint(\"You have consumed a health potion.\")<\/pre><\/div>\n\n\n\n<p>This class represents a player in a video game. It contains both attributes and methods. Attributes are often called instance variables when they are inside a class.<br><\/p>\n\n\n\n<p>One method allows you to wield a sword and the other method allows you to drink a health potion. The class contains one class variable: name. This stores the default name for our player.<br><\/p>\n\n\n\n<p>Notice that we\u2019re using the word <code>self<\/code> a few times in this code. Self is what it sounds like: a representation of the class itself. Self contains all of the values that are stored within a particular class, so you can access them all inside your methods.<br><\/p>\n\n\n\n<p>When we run our code, nothing happens. What&#8217;s going on? Remember how we said that a class was a blueprint? That\u2019s the reason nothing is happening. We\u2019ve got to do something with our blueprint in order for it to become useful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is an Object?<\/h2>\n\n\n\n<p>An object is a single instance of a class. It is defined using the blueprint created by a class.<br><\/p>\n\n\n\n<p>Let\u2019s create an object for a new player in our game, Luke:<br><\/p>\n\n\n\n<p><code>luke = Player()<br><\/code><\/p>\n\n\n\n<p>We\u2019ve just created an object called Luke. Our object can now access all of the data that is stored within our class, as well as the methods associated with our class:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>luke = Player()\nprint(luke.name)\nluke.wield_sword()\n<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<p>Luke<\/p>\n\n\n\n<p>You have wielded your sword.<br><\/p>\n\n\n\n<p>In our code, we\u2019ve printed out the value of the <code>name<\/code> attribute in our Luke object. To access the attributes in a class, you must state the name of the class, followed by a dot, then the instance attribute that you want to access. This is often called <code>dot notation<\/code>.<br><\/p>\n\n\n\n<p>By default, the value of <code>name<\/code> was set to Luke. We\u2019ll talk about how to change this in a minute.<br><\/p>\n\n\n\n<p>We\u2019ve also called our <code>wield_sword() <\/code>class. When we called this class, the contents of the <code>wield_sword()<\/code> method inside our Player class were executed. That caused a message to be printed to the console stating\u201d \u201cYou have wielded your sword.\u201d<br><\/p>\n\n\n\n<p>You can declare as many objects of a class as you\u2019d like: that\u2019s why classes are so powerful. You can reuse the same methods and default values that are stored within a class across multiple different objects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Class Constructors<\/h2>\n\n\n\n<p>Constructors allow you to initialize data inside a class. A constructor method is executed immediately after you declare an object of a particular class.<br><\/p>\n\n\n\n<p>The name for a constructor is <code>__init__()<\/code>. You may be used to seeing functions with double underscores (__) in your code. These functions are called special functions because they have a predefined purpose. In this case, the purpose of <code>__init__<\/code> is to initialize our class.<br><\/p>\n\n\n\n<p>Update the Player class that we created earlier to include this method at the top of the class:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>def __init__(self):\n\tprint(\"Your character has been created.\")\n<\/pre><\/div>\n\n\n\n<p>This method must come before any variables or methods are defined in your class. Let\u2019s run our main code from earlier again:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>luke = Player()\nprint(luke.name)\nluke.wield_sword()\n<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<p>Your character has been created.<\/p>\n\n\n\n<p>Luke<\/p>\n\n\n\n<p>You have wielded your sword.<br><\/p>\n\n\n\n<p>We didn\u2019t call the <code>__init__<\/code> method in our main program but it ran anyway. That\u2019s because constructors are automatically executed when you create an object of a class.<br><\/p>\n\n\n\n<p>Earlier, we assigned the value of the <code>name<\/code> variable in our class to Luke. While this is useful if we want to call our player Luke, it\u2019s not practical if players can have different names.<br><\/p>\n\n\n\n<p>That\u2019s where constructors come in. Let\u2019s create a constructor that allows us to assign a name to our player:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Player:\n\tdef __init__(self, name):\n\t\tself.name = name\n<\/pre><\/div>\n\n\n\n<p>This code allows us to pass a parameter into each Player object. This parameter will represent the name of the player. We\u2019ll then create a method that tells us our player\u2019s name:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Player:\n\tdef __init__(self, name):\n\t\tself.name = name\n\tdef get_name(self):\n\t\tprint(\"Your name is \" + self.name)<\/pre><\/div>\n\n\n\n<p>Let\u2019s create a new instance of our Player class for a player named Leah:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>leah = Player(\"Leah\")\nleah.get_name()\n<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<p>Your name is Leah.<br><\/p>\n\n\n\n<p>We\u2019ve assigned the value of the <code>name<\/code> variable in our object to Leah. This means that wherever we reference it in our class, its value is Leah. The constructor is executed as soon as we create an object of our class, so we don\u2019t have to worry about calling it.<br><\/p>\n\n\n\n<p>We then call the method <code>get_name() <\/code>which prints out the name associated with our player.<br><\/p>\n\n\n\n<p>You can add in as many parameters to a class as you want:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>class Player:\n\tdef __init__(self, name, player_type):\n\t\tself.name = name\n\t\tself.player_type = player_type\n\tdef get_name(self):\n\t\tprint(\"Your name is \" + self.name)\n\tdef get_player_type(self):\n\t\tprint(self.name + \" is a \" + self.player_type + \".\")<\/pre><\/div>\n\n\n\n<p>In this example, our Player class supports two parameters. One represents the name of a Player (name) and the other represents the type of that player (<code>player_type<\/code>). Let\u2019s create an object of this class:<br><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre>leah = Player(\"Leah\", \"Mage\")\nleah.get_name()\nleah.get_player_type()\n<\/pre><\/div>\n\n\n\n<p>Our code returns:<br><\/p>\n\n\n\n<p>Your name is Leah.<\/p>\n\n\n\n<p>Leah is a Mage.<br><\/p>\n\n\n\n<p>Both of the initial values we specified are accessible in our class.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Classes allow you to reduce repetition in your code. Once you\u2019ve defined a class, you can use its structure to define as many objects as you want. As a result of the reduced repetition, your code should be easier to read, and therefore easier to maintain.<br><\/p>\n\n\n\n<p>Now you\u2019re ready to start writing your own Python classes like an expert!<br><\/p>\n","protected":false},"excerpt":{"rendered":"Today we\u2019re going to be talking about classes. No, we don\u2019t mean school classes. In programming, classes have their own definition. A class is a blueprint created by a coder for an object. It defines the data that can be stored in an object and the methods which can be performed on that particular object.&hellip;","protected":false},"author":240,"featured_media":19086,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[16578],"tags":[],"class_list":{"0":"post-19085","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-python"},"acf":{"post_sub_title":"","sprint_id":"","query_class":"Python","school_sft":"","parent_sft":"","school_privacy_policy":"","has_review":"","is_sponser_post":"","is_guest_post":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.0 (Yoast SEO v27.0) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Class: A Beginner\u2019s Guide | Career Karma<\/title>\n<meta name=\"description\" content=\"Classes and objects are standard features of object-oriented languages like Python. On Career Karma, learn how to create and work with classes and objects.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/careerkarma.com\/blog\/python-class\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Classes and Objects in Python for Beginners\" \/>\n<meta property=\"og:description\" content=\"Classes and objects are standard features of object-oriented languages like Python. On Career Karma, learn how to create and work with classes and objects.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/careerkarma.com\/blog\/python-class\/\" \/>\n<meta property=\"og:site_name\" content=\"Career Karma\" \/>\n<meta property=\"article:publisher\" content=\"http:\/\/facebook.com\/careerkarmaapp\" \/>\n<meta property=\"article:published_time\" content=\"2020-07-07T00:26:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-01T11:38:52+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"667\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"James Gallagher\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@career_karma\" \/>\n<meta name=\"twitter:site\" content=\"@career_karma\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"James Gallagher\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/\"},\"author\":{\"name\":\"James Gallagher\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"headline\":\"Classes and Objects in Python for Beginners\",\"datePublished\":\"2020-07-07T00:26:41+00:00\",\"dateModified\":\"2023-12-01T11:38:52+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/\"},\"wordCount\":1080,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-class\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/python-class\/\",\"name\":\"Python Class: A Beginner\u2019s Guide | Career Karma\",\"isPartOf\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg\",\"datePublished\":\"2020-07-07T00:26:41+00:00\",\"dateModified\":\"2023-12-01T11:38:52+00:00\",\"author\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\"},\"description\":\"Classes and objects are standard features of object-oriented languages like Python. On Career Karma, learn how to create and work with classes and objects.\",\"breadcrumb\":{\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/careerkarma.com\/blog\/python-class\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg\",\"width\":1000,\"height\":667},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/careerkarma.com\/blog\/python-class\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Blog\",\"item\":\"https:\/\/careerkarma.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/careerkarma.com\/blog\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Classes and Objects in Python for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#website\",\"url\":\"https:\/\/careerkarma.com\/blog\/\",\"name\":\"Career Karma\",\"description\":\"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/careerkarma.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94\",\"name\":\"James Gallagher\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"contentUrl\":\"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg\",\"caption\":\"James Gallagher\"},\"description\":\"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.\",\"url\":\"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Class: A Beginner\u2019s Guide | Career Karma","description":"Classes and objects are standard features of object-oriented languages like Python. On Career Karma, learn how to create and work with classes and objects.","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:\/\/careerkarma.com\/blog\/python-class\/","og_locale":"en_US","og_type":"article","og_title":"Classes and Objects in Python for Beginners","og_description":"Classes and objects are standard features of object-oriented languages like Python. On Career Karma, learn how to create and work with classes and objects.","og_url":"https:\/\/careerkarma.com\/blog\/python-class\/","og_site_name":"Career Karma","article_publisher":"http:\/\/facebook.com\/careerkarmaapp","article_published_time":"2020-07-07T00:26:41+00:00","article_modified_time":"2023-12-01T11:38:52+00:00","og_image":[{"width":1000,"height":667,"url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg","type":"image\/jpeg"}],"author":"James Gallagher","twitter_card":"summary_large_image","twitter_creator":"@career_karma","twitter_site":"@career_karma","twitter_misc":{"Written by":"James Gallagher","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/careerkarma.com\/blog\/python-class\/#article","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/python-class\/"},"author":{"name":"James Gallagher","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"headline":"Classes and Objects in Python for Beginners","datePublished":"2020-07-07T00:26:41+00:00","dateModified":"2023-12-01T11:38:52+00:00","mainEntityOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-class\/"},"wordCount":1080,"commentCount":0,"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/careerkarma.com\/blog\/python-class\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/careerkarma.com\/blog\/python-class\/","url":"https:\/\/careerkarma.com\/blog\/python-class\/","name":"Python Class: A Beginner\u2019s Guide | Career Karma","isPartOf":{"@id":"https:\/\/careerkarma.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage"},"image":{"@id":"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage"},"thumbnailUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg","datePublished":"2020-07-07T00:26:41+00:00","dateModified":"2023-12-01T11:38:52+00:00","author":{"@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94"},"description":"Classes and objects are standard features of object-oriented languages like Python. On Career Karma, learn how to create and work with classes and objects.","breadcrumb":{"@id":"https:\/\/careerkarma.com\/blog\/python-class\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/careerkarma.com\/blog\/python-class\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/python-class\/#primaryimage","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/07\/maxwell-nelson-Ix64NPGxZoQ-unsplash.jpg","width":1000,"height":667},{"@type":"BreadcrumbList","@id":"https:\/\/careerkarma.com\/blog\/python-class\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog","item":"https:\/\/careerkarma.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/careerkarma.com\/blog\/python\/"},{"@type":"ListItem","position":3,"name":"Classes and Objects in Python for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/careerkarma.com\/blog\/#website","url":"https:\/\/careerkarma.com\/blog\/","name":"Career Karma","description":"Latest Coding Bootcamp News &amp; Career Hacks from Industry Insiders","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/careerkarma.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/e79364792443fbff794a144c67ec8e94","name":"James Gallagher","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/careerkarma.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","contentUrl":"https:\/\/careerkarma.com\/blog\/wp-content\/uploads\/2020\/01\/james-gallagher-150x150.jpg","caption":"James Gallagher"},"description":"James Gallagher is a self-taught programmer and the technical content manager at Career Karma. He has experience in range of programming languages and extensive expertise in Python, HTML, CSS, and JavaScript. James has written hundreds of programming tutorials, and he frequently contributes to publications like Codecademy, Treehouse, Repl.it, Afrotech, and others.","url":"https:\/\/careerkarma.com\/blog\/author\/jamesgallagher\/"}]}},"_links":{"self":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19085","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/users\/240"}],"replies":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/comments?post=19085"}],"version-history":[{"count":0,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/posts\/19085\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media\/19086"}],"wp:attachment":[{"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/media?parent=19085"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/categories?post=19085"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/careerkarma.com\/blog\/wp-json\/wp\/v2\/tags?post=19085"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}