{"id":805,"date":"2020-09-01T12:09:48","date_gmt":"2020-09-01T12:09:48","guid":{"rendered":"http:\/\/learnlearn.uk\/alevelcs\/?page_id=805"},"modified":"2020-09-01T12:11:57","modified_gmt":"2020-09-01T12:11:57","slug":"classes-objects-programming-exercises-python","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/","title":{"rendered":"Classes &#038; Objects Programming Exercises in Python"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Challenge 1 - Dog<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Challenge 1 &#8211; Dog Class<\/h3>\n<p><strong>Class Dog<\/strong><\/p>\n<p>Attributes:<\/p>\n<ul>\n<li>Name<\/li>\n<li>size<\/li>\n<li>Breed <em>Default: &#8216;Unknown&#8217;<\/em><\/li>\n<li>Date of birth in DD\/MM\/YYYY format\u00a0\u00a0<em>Default: &#8216;Unknown&#8217;<\/em><\/li>\n<\/ul>\n<p>Methods:<\/p>\n<ul>\n<li>Bark\n<ul>\n<li>This should get the dog to bark (print out the word &#8216;woof!&#8217;)<\/li>\n<\/ul>\n<\/li>\n<li>get_name\n<ul>\n<li>This should return the dog&#8217;s name<\/li>\n<\/ul>\n<\/li>\n<li>set_name\n<ul>\n<li>This should allow the user to set an alphabetical name between 2 and 30 characters.<\/li>\n<li>Convert the name to title case before setting<\/li>\n<\/ul>\n<\/li>\n<li>dog_years\n<ul>\n<li>This should calculate a dog&#8217;s age in dog years (use 1 year = 7 dog years)<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n<\/div><h2 class=\"tabtitle\">Challenge 2 - Deck of Cards<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Challenge 2 &#8211; Deck of Cards<\/h3>\n<p>Create 2 Classes:<\/p>\n<h4>Class Card<\/h4>\n<p>Attributes:<\/p>\n<ul>\n<li>name<\/li>\n<li>value<\/li>\n<\/ul>\n<h4>Class Deck<\/h4>\n<p>Attributes:<\/p>\n<ul>\n<li>pack: this should be initialised to a list of full deck of cards objects<\/li>\n<li>discarded: This should be initialised to an empty list<\/li>\n<\/ul>\n<p>Methods<\/p>\n<ul>\n<li>Shuffle<\/li>\n<li>Pick a card (should return a card instance from the top of the deck)<\/li>\n<\/ul>\n<p>Create a simple higher or lower game using your deck of cards<\/p>\n<\/div><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Challenge 1 &#8211; Dog Class Class Dog Attributes: Name size Breed Default: &#8216;Unknown&#8217; Date of birth in DD\/MM\/YYYY format\u00a0\u00a0Default: &#8216;Unknown&#8217; Methods: Bark This should get the dog to bark (print out the word &#8216;woof!&#8217;) get_name This should return the dog&#8217;s name set_name This should allow the user to set an alphabetical name between 2 and&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Classes &#038; Objects Programming Exercises in Python<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":70,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Classes &amp; Objects Programming Exercises in Python - A Level Computer Science<\/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:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Classes &amp; Objects Programming Exercises in Python - A Level Computer Science\" \/>\n<meta property=\"og:description\" content=\"Challenge 1 &#8211; Dog Class Class Dog Attributes: Name size Breed Default: &#8216;Unknown&#8217; Date of birth in DD\/MM\/YYYY format\u00a0\u00a0Default: &#8216;Unknown&#8217; Methods: Bark This should get the dog to bark (print out the word &#8216;woof!&#8217;) get_name This should return the dog&#8217;s name set_name This should allow the user to set an alphabetical name between 2 and&hellip;&nbsp;Read More &raquo;Classes &#038; Objects Programming Exercises in Python\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/\" \/>\n<meta property=\"og:site_name\" content=\"A Level Computer Science\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-01T12:11:57+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/\",\"name\":\"Classes & Objects Programming Exercises in Python - A Level Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\"},\"datePublished\":\"2020-09-01T12:09:48+00:00\",\"dateModified\":\"2020-09-01T12:11:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"A Level Computer Science Home\",\"item\":\"https:\/\/learnlearn.uk\/alevelcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Classes &#038; Objects Programming Exercises in Python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/\",\"name\":\"A Level Computer Science\",\"description\":\"CIE Specification\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/alevelcs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#organization\",\"name\":\"A Level Computer Science\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png\",\"width\":710,\"height\":98,\"caption\":\"A Level Computer Science\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Classes & Objects Programming Exercises in Python - A Level Computer Science","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:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/","og_locale":"en_GB","og_type":"article","og_title":"Classes & Objects Programming Exercises in Python - A Level Computer Science","og_description":"Challenge 1 &#8211; Dog Class Class Dog Attributes: Name size Breed Default: &#8216;Unknown&#8217; Date of birth in DD\/MM\/YYYY format\u00a0\u00a0Default: &#8216;Unknown&#8217; Methods: Bark This should get the dog to bark (print out the word &#8216;woof!&#8217;) get_name This should return the dog&#8217;s name set_name This should allow the user to set an alphabetical name between 2 and&hellip;&nbsp;Read More &raquo;Classes &#038; Objects Programming Exercises in Python","og_url":"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/","og_site_name":"A Level Computer Science","article_modified_time":"2020-09-01T12:11:57+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/","url":"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/","name":"Classes & Objects Programming Exercises in Python - A Level Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#website"},"datePublished":"2020-09-01T12:09:48+00:00","dateModified":"2020-09-01T12:11:57+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/alevelcs\/classes-objects-programming-exercises-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"A Level Computer Science Home","item":"https:\/\/learnlearn.uk\/alevelcs\/"},{"@type":"ListItem","position":2,"name":"Classes &#038; Objects Programming Exercises in Python"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/alevelcs\/#website","url":"https:\/\/learnlearn.uk\/alevelcs\/","name":"A Level Computer Science","description":"CIE Specification","publisher":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/alevelcs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/alevelcs\/#organization","name":"A Level Computer Science","url":"https:\/\/learnlearn.uk\/alevelcs\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png","contentUrl":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png","width":710,"height":98,"caption":"A Level Computer Science"},"image":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/alevelcs\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Challenge 1 &#8211; Dog Class Class Dog Attributes: Name size Breed Default: &#8216;Unknown&#8217; Date of birth in DD\/MM\/YYYY format\u00a0\u00a0Default: &#8216;Unknown&#8217; Methods: Bark This should get the dog to bark (print out the word &#8216;woof!&#8217;) get_name This should return the dog&#8217;s name set_name This should allow the user to set an alphabetical name between 2 and&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/805"}],"collection":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/comments?post=805"}],"version-history":[{"count":3,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/805\/revisions"}],"predecessor-version":[{"id":808,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/805\/revisions\/808"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/media?parent=805"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}