A set of 45 standalone Python examples, progressing from core programming exercises to algorithms, data structures, concurrency, and practical file tools.
Use Python 3.10 or newer. Most scripts use only the standard library.
python 01_fizzbuzz.py
python 17_dijkstra.pySome utilities accept a file path or URL as a command-line argument; inspect the top of the script before running it. 43_palette.py optionally uses Pillow. The JWT example decodes a token payload for inspection and does not verify the signature.
| Script | Example |
|---|---|
| 01_fizzbuzz.py | FizzBuzz |
| 02_factorial.py | factorial |
| 03_prime_check.py | prime check |
| 04_gcd_lcm.py | GCD and LCM |
| 05_palindrome.py | palindrome check |
| 06_word_count.py | word frequency |
| 07_binary_search.py | binary search |
| 08_selection_sort.py | selection sort |
| 09_merge_sort.py | merge sort |
| 10_fibonacci.py | Fibonacci |
| 11_caesar_cipher.py | Caesar cipher |
| 12_anagram_check.py | anagram check |
| 13_roman_numerals.py | Roman numerals |
| 14_matrix_transpose.py | matrix transpose |
| 15_matrix_multiply.py | matrix multiplication |
| 16_bfs_path.py | BFS shortest path |
| 17_dijkstra.py | Dijkstra shortest paths |
| 18_topological_sort.py | topological sort |
| 19_knapsack.py | 0/1 knapsack |
| 20_coin_change.py | minimum coin change |
| 21_sudoku_validator.py | Sudoku validation |
| 22_maze_solver.py | maze traversal |
| 23_lru_cache.py | LRU cache |
| 24_token_bucket.py | token bucket limiter |
| 25_sqlite_notes.py | SQLite notes |
| 26_csv_cleaner.py | CSV cleanup |
| 27_json_flatten.py | nested JSON flattening |
| 28_duplicate_finder.py | duplicate file finder |
| 29_markdown_links.py | Markdown link check |
| 30_log_parser.py | log parser |
| 31_password_meter.py | password meter |
| 32_expression_calc.py | restricted arithmetic evaluator |
| 33_retry_decorator.py | retry decorator |
| 34_async_jobs.py | async task queue |
| 35_pomodoro.py | focus timer |
| 36_expense_tracker.py | expense tracker |
| 37_kmeans.py | k-means clustering |
| 38_roman_parser.py | Roman numeral example |
| 39_dependency_order.py | dependency ordering |
| 40_jwt_inspector.py | JWT payload inspection |
| 41_xml_converter.py | XML conversion |
| 42_wave_stats.py | WAV metadata |
| 43_palette.py | image palette (Pillow) |
| 44_http_checker.py | HTTP status check |
| 45_genetic_bits.py | genetic algorithm demo |
Keep examples self-contained, explain non-obvious choices in comments, and document optional dependencies or command-line inputs in the script docstring.