{"id":26678264,"url":"https://github.com/csaba79-coder/sorting_flowchart_python_practice","last_synced_at":"2026-07-09T13:31:05.671Z","repository":{"id":108981726,"uuid":"355257415","full_name":"Csaba79-coder/Sorting_flowchart_python_practice","owner":"Csaba79-coder","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-06T16:28:17.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T09:44:49.703Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Csaba79-coder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-06T16:26:52.000Z","updated_at":"2021-04-06T16:28:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"82f59974-c765-4584-8e85-4ea30d8f9ba2","html_url":"https://github.com/Csaba79-coder/Sorting_flowchart_python_practice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Csaba79-coder/Sorting_flowchart_python_practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Csaba79-coder%2FSorting_flowchart_python_practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Csaba79-coder%2FSorting_flowchart_python_practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Csaba79-coder%2FSorting_flowchart_python_practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Csaba79-coder%2FSorting_flowchart_python_practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Csaba79-coder","download_url":"https://codeload.github.com/Csaba79-coder/Sorting_flowchart_python_practice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Csaba79-coder%2FSorting_flowchart_python_practice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35301501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-09T02:00:07.329Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-26T05:15:19.331Z","updated_at":"2026-07-09T13:31:05.651Z","avatar_url":"https://github.com/Csaba79-coder.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sorting flowchart\n\n## Story\n\nYour friend Maria has found an old and dusty notebook with almost faded pages with some flowcharts on it,\nand she asked you for help to write the equivalent python script based on them.\nFirst one looks like a simple sorting algorithm that repeatedly steps through the list,\ncompares each pair of adjacent items and swaps them if they are in the wrong order.\nSecond one seems to dividing the list into smaller ones to find searched value.\nThird one is looking for prime numbers.\n\n\n## What are you going to learn?\n\nYou will learn and practice how to do the following things:\n\n- write code from flowchart,\n- how to sort numbers without built-in functions,\n- for and while loops,\n- algorithms,\n- clean code refactoring (making code more easy to read and maintain\n  without changing any feature).\n\n## Tasks\n\n1. Implement the algorithm described by [this flowchart](media/progbasics/bubble-sort-flowchart.png).\n    - Running the program outputs the following numbers in a list: [1, 2, 56, 32, 51, 2, 8, 92, 15]\n    - Running the program outputs the above numbers in a list in ascending order without hard coding the order (using the steps seen in the flowchart): [1, 2, 2, 8, 15, 32, 51, 56, 92]\n\n2. Implement the algorithm described by [this flowchart](media/progbasics/binary-search-flowchart.png).\n    - Running the program outputs the following numbers in a list: [1, 2, 4, 7, 11, 22, 38, 42, 43]\n    - Running the program outputs an index of searched value in an list, if not present then returns -1 (i.e. for value 4 should return 2)\n\n3. [OPTIONAL] Implement the Sieve of Eratosthenes algorithm described by [this flowchart](media/progbasics/sieve-of-eratosthenes-flowchart.png).\n    - Given a number n, find all primes smaller than or equal to n. Then display them in console.\n\n4. Refactor your solution: use functions, make it more easy to read and maintain.\n    - Running the program results in the exact same behavior before and after refactoring.\n    - Variable names in the program are meaningful nouns and not abbreviated\n    - Function names in the program are meaningful verbs and not abbreviated\n    - There are no unnecessary (dead) code or comments in the program\n    - There are no duplicating code parts or code parts doing the same thing differently in the program\n    - There are no function that doing more than one thing in the program\n    - After each modification the changes are committed, the program is runnable and results in the exact same behavior than at the beginning\n    - Commit messages are meaningful\n\n## General requirements\n\nNone\n\n## Hints\n\n- Bubble sort: There are two loops and both of them can be implemented with `while` or `for`\n  (but think about which is better when).\n- Bubble sort: One loop is an outer loop and one is an inner loop. Do you know which one is which?\n- While refactoring make sure you protect the main part of the program\n  (outside of the functions) with an `if __name__ == \"__main__\":`\n  [code snippet](https://docs.python.org/3/library/__main__.html).\n- Sieve of Eratosthenes: Use an auxiliary list which stores information whether number is a prime number.\n\n\n## Background materials\n\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [About Flowcharts](project/curriculum/materials/pages/general/flowcharts.md)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [Basics of clean code](project/curriculum/materials/competencies/clean-code.md.html)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [Refactoring in action](project/curriculum/materials/competencies/clean-code/refactoring.md.html)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [About nice commit messages](https://chris.beams.io/posts/git-commit/)\n- \u003ci class=\"far fa-video\"\u003e\u003c/i\u003e [Bubble-sort with Hungarian (\"Csángó\") folk dance](https://www.youtube.com/watch?v=lyZQPjUT5B4)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [Divide and conquer](https://en.wikipedia.org/wiki/Divide-and-conquer_algorithm)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [Binary search](https://www.khanacademy.org/computing/computer-science/algorithms/binary-search/a/binary-search)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [Sieve of Eratosthenes](https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes#/media/File:Sieve_of_Eratosthenes_animation.gif)\n- \u003ci class=\"far fa-exclamation\"\u003e\u003c/i\u003e [What is `if __name__ == \"__main__\"`??](https://thepythonguru.com/what-is-if-__name__-__main__/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsaba79-coder%2Fsorting_flowchart_python_practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsaba79-coder%2Fsorting_flowchart_python_practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsaba79-coder%2Fsorting_flowchart_python_practice/lists"}