{"id":33572,"date":"2024-11-01T09:18:01","date_gmt":"2024-11-01T09:18:01","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=33572"},"modified":"2024-11-01T11:47:35","modified_gmt":"2024-11-01T11:47:35","slug":"python-coding-test-course-finding-good-numbers","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/33572\/","title":{"rendered":"Python Coding Test Course, &#8216;Finding Good Numbers&#8217;"},"content":{"rendered":"<p><body><\/p>\n<article>\n<header>\n<p>Author: [Author Name] | Date: [Date]<\/p>\n<\/header>\n<section>\n<h2>Problem Description<\/h2>\n<p>\n                This is a problem to find a number n that is a &#8220;good number.&#8221;<br \/>\n                The conditions for a &#8220;good number&#8221; are as follows.\n            <\/p>\n<ul>\n<li>A &#8220;good number&#8221; is a natural number with two or more digits.<\/li>\n<li>A number is defined as a &#8220;good number&#8221; if the sum of its digits is odd.<\/li>\n<li>Find all &#8220;good numbers&#8221; less than or equal to the given n and return them as a list.<\/li>\n<\/ul>\n<p>\n                For example, if n is 30, the &#8220;good numbers&#8221; are 11, 13, 15, 17, 19, 21, 23, 25, 27, 29.<br \/>\n                We will design an algorithm to solve this problem and implement the code.\n            <\/p>\n<\/section>\n<section>\n<h2>Problem-Solving Approach<\/h2>\n<p>\n                Let&#8217;s approach the problem step by step.<br \/>\n                First, since we only consider cases where n is a natural number with two or more digits, we will use a loop from 10 to n to calculate the sum of the digits for each number.\n            <\/p>\n<p>\n                To calculate the sum of the digits of a number, we can convert the given number to a string,<br \/>\n                then convert each digit back to an integer and add it to the total sum.<br \/>\n                Next, we will check if that sum is odd, and if so, add the number to the list of good numbers.\n            <\/p>\n<\/section>\n<section>\n<h2>Code Implementation<\/h2>\n<p>Now, let&#8217;s implement the algorithm described above in Python.<\/p>\n<pre><code>\ndef is_good_number(num):\n    # Calculate the sum of the digits and check if it is odd\n    digit_sum = sum(int(digit) for digit in str(num))\n    return digit_sum % 2 == 1\n\ndef find_good_numbers(n):\n    good_numbers = []\n    for i in range(10, n + 1):  # digits with two or more\n        if is_good_number(i):\n            good_numbers.append(i)\n    return good_numbers\n\n# Test\nn = 30\nprint(find_good_numbers(n))\n            <\/code><\/pre>\n<p>\n                The above code uses a function called <code>is_good_number<\/code> to calculate the sum of the digits of a given number and check<br \/>\n                whether that sum is odd. <\/p>\n<p><code>find_good_numbers<\/code> function loops through all numbers from 10 to n,<br \/>\n                finding &#8220;good numbers&#8221; and adding them to a list to return.\n            <\/p>\n<\/section>\n<section>\n<h2>Execution Result<\/h2>\n<p>\n                The result of executing the function for <code>n = 30<\/code> is as follows:\n            <\/p>\n<pre><code>\n[11, 13, 15, 17, 19, 21, 23, 25, 27, 29]\n            <\/code><\/pre>\n<p>\n                As shown above, the &#8220;good numbers&#8221; 11, 13, 15, 17, 19, 21, 23, 25, 27, 29 have been returned.<br \/>\n                This result satisfies the condition of being &#8220;natural numbers with two or more digits whose sum of digits is odd.&#8221;\n            <\/p>\n<\/section>\n<section>\n<h2>Complexity Analysis<\/h2>\n<p>\n                Looking at the time complexity of the above algorithm,<br \/>\n                since we have to iterate through all the numbers up to the given n, the time complexity is O(n).<br \/>\n                For each number, we need additional constant time to calculate the sum of its digits, so overall it can be confirmed as O(n).\n            <\/p>\n<p>\n                The space complexity is O(k)<br \/>\n                (where k is the number of &#8220;good numbers&#8221;) due to the list used to store the &#8220;good numbers.&#8221;<br \/>\n                In practice, since the smaller n is, the fewer &#8220;good numbers&#8221; will be stored, thus allowing for efficient space usage.\n            <\/p>\n<\/section>\n<section>\n<h2>Conclusion<\/h2>\n<p>\n                Through this problem, we have learned a method to effectively find \u201cgood numbers\u201d by considering counterexamples and calculating the sum of the digits.<br \/>\n                We were able to explore various ways to improve efficiency through a step-by-step approach to problem-solving and<br \/>\n                implementation using Python code, as well as complexity analysis.\n            <\/p>\n<p>\n                In the future, practice various ways of thinking and solving through more algorithm problems.<br \/>\n                Understanding and approaching problems is very important in coding tests.\n            <\/p>\n<\/section>\n<\/article>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: [Author Name] | Date: [Date] Problem Description This is a problem to find a number n that is a &#8220;good number.&#8221; The conditions for a &#8220;good number&#8221; are as follows. A &#8220;good number&#8221; is a natural number with two or more digits. A number is defined as a &#8220;good number&#8221; if the sum of &hellip; <a href=\"https:\/\/atmokpo.com\/w\/33572\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Python Coding Test Course, &#8216;Finding Good Numbers&#8217;&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[145],"tags":[],"class_list":["post-33572","post","type-post","status-publish","format-standard","hentry","category-python-coding-test"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Python Coding Test Course, &#039;Finding Good Numbers&#039; - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/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:\/\/atmokpo.com\/w\/33572\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Coding Test Course, &#039;Finding Good Numbers&#039; - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Author: [Author Name] | Date: [Date] Problem Description This is a problem to find a number n that is a &#8220;good number.&#8221; The conditions for a &#8220;good number&#8221; are as follows. A &#8220;good number&#8221; is a natural number with two or more digits. A number is defined as a &#8220;good number&#8221; if the sum of &hellip; \ub354 \ubcf4\uae30 &quot;Python Coding Test Course, &#8216;Finding Good Numbers&#8217;&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/33572\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:18:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:47:35+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/33572\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33572\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Python Coding Test Course, &#8216;Finding Good Numbers&#8217;\",\"datePublished\":\"2024-11-01T09:18:01+00:00\",\"dateModified\":\"2024-11-01T11:47:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33572\/\"},\"wordCount\":475,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Python Coding Test\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/33572\/\",\"url\":\"https:\/\/atmokpo.com\/w\/33572\/\",\"name\":\"Python Coding Test Course, 'Finding Good Numbers' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:18:01+00:00\",\"dateModified\":\"2024-11-01T11:47:35+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/33572\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/33572\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/33572\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python Coding Test Course, &#8216;Finding Good Numbers&#8217;\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python Coding Test Course, 'Finding Good Numbers' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","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:\/\/atmokpo.com\/w\/33572\/","og_locale":"ko_KR","og_type":"article","og_title":"Python Coding Test Course, 'Finding Good Numbers' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Author: [Author Name] | Date: [Date] Problem Description This is a problem to find a number n that is a &#8220;good number.&#8221; The conditions for a &#8220;good number&#8221; are as follows. A &#8220;good number&#8221; is a natural number with two or more digits. A number is defined as a &#8220;good number&#8221; if the sum of &hellip; \ub354 \ubcf4\uae30 \"Python Coding Test Course, &#8216;Finding Good Numbers&#8217;\"","og_url":"https:\/\/atmokpo.com\/w\/33572\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:18:01+00:00","article_modified_time":"2024-11-01T11:47:35+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/33572\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/33572\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Python Coding Test Course, &#8216;Finding Good Numbers&#8217;","datePublished":"2024-11-01T09:18:01+00:00","dateModified":"2024-11-01T11:47:35+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/33572\/"},"wordCount":475,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Python Coding Test"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/33572\/","url":"https:\/\/atmokpo.com\/w\/33572\/","name":"Python Coding Test Course, 'Finding Good Numbers' - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:18:01+00:00","dateModified":"2024-11-01T11:47:35+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/33572\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/33572\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/33572\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Python Coding Test Course, &#8216;Finding Good Numbers&#8217;"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=33572"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33572\/revisions"}],"predecessor-version":[{"id":33573,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/33572\/revisions\/33573"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=33572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=33572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=33572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}