├── concepts ├── none │ ├── links.json │ └── about.md ├── bytes │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── aliasing │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── bitflags │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── binary-data │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── iteration │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── iterators │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── itertools │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── sequences │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── testing │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── anonymous-functions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── collections │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── dataclasses │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── descriptors │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── memoryview │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── type-hinting │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── class-composition │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── class-customization │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── class-interfaces │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── functional-tools │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── list-comprehensions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── number-variations │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── regular-expressions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── rich-comparisons │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── text-processing │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── user-defined-errors │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── walrus-operator │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── generator-expressions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── higher-order-functions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── operator-overloading │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── other-comprehensions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── string-methods-splitting │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── with-statement │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── context-manager-customization │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── raising-and-handling-errors │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── unicode-regular-expressions │ ├── about.md │ ├── introduction.md │ └── .meta │ │ └── config.json ├── binary-octal-hexadecimal │ ├── .meta │ │ └── config.json │ └── links.json ├── bitwise-operators │ └── .meta │ │ └── config.json ├── recursion │ └── .meta │ │ └── config.json ├── functools │ └── .meta │ │ └── config.json ├── secrets │ └── .meta │ │ └── config.json ├── comparisons │ └── .meta │ │ └── config.json ├── fractions │ └── .meta │ │ └── config.json ├── random │ └── .meta │ │ └── config.json ├── decorators │ └── .meta │ │ └── config.json ├── complex-numbers │ └── .meta │ │ └── config.json ├── dict-methods │ └── .meta │ │ └── config.json ├── bools │ └── .meta │ │ └── config.json ├── loops │ └── .meta │ │ └── config.json ├── generators │ └── .meta │ │ └── config.json ├── function-arguments │ └── .meta │ │ └── config.json ├── sets │ └── .meta │ │ └── config.json ├── basics │ └── .meta │ │ └── config.json ├── classes │ └── .meta │ │ └── config.json ├── enums │ └── .meta │ │ └── config.json └── tuples │ └── .meta │ └── config.json ├── exercises ├── practice │ ├── bowling │ │ ├── .gitignore │ │ └── bowling.py │ ├── say │ │ ├── say.py │ │ ├── .meta │ │ │ └── additional_tests.json │ │ └── .docs │ │ │ └── instructions.md │ ├── darts │ │ ├── darts.py │ │ └── .approaches │ │ │ ├── booleans-as-ints │ │ │ └── snippet.txt │ │ │ ├── dict-and-dict-get │ │ │ └── snippet.txt │ │ │ ├── if-statements │ │ │ └── snippet.txt │ │ │ ├── match-case │ │ │ └── snippet.txt │ │ │ ├── tuple-and-loop │ │ │ └── snippet.txt │ │ │ └── dict-and-generator │ │ │ └── snippet.txt │ ├── bob │ │ ├── bob.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ ├── .approaches │ │ │ ├── if-statements-nested │ │ │ │ └── snippet.txt │ │ │ ├── if-statements │ │ │ │ └── snippet.txt │ │ │ └── answer-list │ │ │ │ └── snippet.txt │ │ └── .docs │ │ │ └── introduction.md │ ├── diamond │ │ └── diamond.py │ ├── leap │ │ ├── leap.py │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .meta │ │ │ └── example.py │ │ ├── .approaches │ │ │ ├── calendar-isleap │ │ │ │ └── snippet.txt │ │ │ ├── boolean-chain │ │ │ │ └── snippet.txt │ │ │ ├── ternary-operator │ │ │ │ └── snippet.txt │ │ │ └── datetime-addition │ │ │ │ └── snippet.txt │ │ └── .articles │ │ │ ├── performance │ │ │ └── snippet.md │ │ │ └── config.json │ ├── poker │ │ ├── poker.py │ │ └── .docs │ │ │ └── instructions.md │ ├── proverb │ │ └── proverb.py │ ├── sieve │ │ ├── sieve.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ ├── code │ │ │ │ │ ├── run_times.feather │ │ │ │ │ └── transposed_logs.feather │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ ├── .approaches │ │ │ ├── comprehensions │ │ │ │ └── snippet.txt │ │ │ ├── set-operations │ │ │ │ └── snippet.txt │ │ │ └── nested-loops │ │ │ │ └── snippet.txt │ │ └── .meta │ │ │ └── example.py │ ├── two-fer │ │ ├── two_fer.py │ │ └── .meta │ │ │ └── example.py │ ├── wordy │ │ ├── wordy.py │ │ └── .approaches │ │ │ ├── lambdas-in-a-dictionary │ │ │ └── snippet.txt │ │ │ ├── regex-with-operator-module │ │ │ └── snippet.txt │ │ │ ├── dunder-getattribute │ │ │ └── snippet.txt │ │ │ ├── functools-reduce │ │ │ └── snippet.txt │ │ │ ├── recursion │ │ │ └── snippet.txt │ │ │ └── import-callables-from-operator │ │ │ └── snippet.txt │ ├── acronym │ │ ├── acronym.py │ │ ├── .meta │ │ │ └── example.py │ │ ├── .approaches │ │ │ ├── regex-join │ │ │ │ └── snippet.txt │ │ │ ├── list-comprehension │ │ │ │ └── snippet.txt │ │ │ ├── map-function │ │ │ │ └── snippet.txt │ │ │ ├── regex-sub │ │ │ │ └── snippet.txt │ │ │ ├── loop │ │ │ │ └── snippet.txt │ │ │ ├── functools-reduce │ │ │ │ └── snippet.txt │ │ │ └── generator-expression │ │ │ │ └── snippet.txt │ │ └── .articles │ │ │ └── config.json │ ├── etl │ │ ├── etl.py │ │ └── .meta │ │ │ └── example.py │ ├── gigasecond │ │ ├── gigasecond.py │ │ ├── .meta │ │ │ └── example.py │ │ └── .docs │ │ │ └── instructions.md │ ├── isogram │ │ ├── isogram.py │ │ ├── .approaches │ │ │ ├── scrub-replace │ │ │ │ └── snippet.txt │ │ │ ├── scrub-comprehension │ │ │ │ └── snippet.txt │ │ │ ├── scrub-regex │ │ │ │ └── snippet.txt │ │ │ ├── findall-regex │ │ │ │ └── snippet.txt │ │ │ └── bitfield │ │ │ │ └── snippet.txt │ │ ├── .meta │ │ │ └── example.py │ │ └── .articles │ │ │ ├── performance │ │ │ └── snippet.md │ │ │ └── config.json │ ├── nth-prime │ │ ├── nth_prime.py │ │ ├── .approaches │ │ │ ├── tracking │ │ │ │ └── snippet.txt │ │ │ └── generator-fun │ │ │ │ └── snippet.txt │ │ ├── .docs │ │ │ └── instructions.md │ │ └── .meta │ │ │ └── additional_tests.json │ ├── octal │ │ ├── octal.py │ │ └── .meta │ │ │ └── example.py │ ├── tournament │ │ └── tournament.py │ ├── trinary │ │ ├── trinary.py │ │ └── .meta │ │ │ └── example.py │ ├── alphametics │ │ └── alphametics.py │ ├── book-store │ │ └── book_store.py │ ├── dominoes │ │ └── dominoes.py │ ├── grep │ │ ├── grep.py │ │ └── .meta │ │ │ └── plugins.py │ ├── pangram │ │ ├── pangram.py │ │ ├── .approaches │ │ │ ├── set-len │ │ │ │ └── snippet.txt │ │ │ ├── all │ │ │ │ └── snippet.txt │ │ │ ├── set-issubset │ │ │ │ └── snippet.txt │ │ │ └── bitfield │ │ │ │ └── snippet.txt │ │ ├── .meta │ │ │ └── example.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ └── .docs │ │ │ └── instructions.md │ ├── pig-latin │ │ ├── pig_latin.py │ │ └── .approaches │ │ │ ├── sets-and-slices │ │ │ └── snippet.txt │ │ │ └── config.json │ ├── raindrops │ │ ├── raindrops.py │ │ ├── .docs │ │ │ └── introduction.md │ │ ├── .approaches │ │ │ ├── if-statements │ │ │ │ └── snippet.txt │ │ │ ├── itertools-compress │ │ │ │ └── snippet.txt │ │ │ ├── truthy-and-falsey-with-fstring │ │ │ │ └── snippet.txt │ │ │ ├── loop-and-fstring │ │ │ │ └── snippet.txt │ │ │ ├── dict-and-join │ │ │ │ └── snippet.txt │ │ │ ├── sequence-with-join │ │ │ │ └── snippet.txt │ │ │ └── functools-reduce │ │ │ │ └── snippet.txt │ │ └── .articles │ │ │ └── config.json │ ├── series │ │ └── series.py │ ├── transpose │ │ ├── transpose.py │ │ └── .meta │ │ │ └── example.py │ ├── beer-song │ │ └── beer_song.py │ ├── binary │ │ ├── binary.py │ │ └── .meta │ │ │ └── example.py │ ├── hamming │ │ ├── hamming.py │ │ ├── .meta │ │ │ └── example.py │ │ └── .approaches │ │ │ ├── sum │ │ │ └── snippet.txt │ │ │ ├── range │ │ │ └── snippet.txt │ │ │ └── zip │ │ │ └── snippet.txt │ ├── hexadecimal │ │ └── hexadecimal.py │ ├── house │ │ └── house.py │ ├── isbn-verifier │ │ ├── isbn_verifier.py │ │ └── .meta │ │ │ └── example.py │ ├── prime-factors │ │ ├── prime_factors.py │ │ └── .meta │ │ │ └── example.py │ ├── rectangles │ │ └── rectangles.py │ ├── reverse-string │ │ ├── reverse_string.py │ │ ├── .meta │ │ │ └── example.py │ │ ├── .approaches │ │ │ ├── sequence-slicing │ │ │ │ └── snippet.txt │ │ │ ├── built-in-reversed │ │ │ │ └── snippet.txt │ │ │ ├── built-in-list-reverse │ │ │ │ └── snippet.txt │ │ │ ├── iteration-and-concatenation │ │ │ │ └── snippet.txt │ │ │ ├── backward-iteration-with-range │ │ │ │ └── snippet.txt │ │ │ └── list-and-join │ │ │ │ └── snippet.txt │ │ ├── .docs │ │ │ ├── instructions.md │ │ │ └── introduction.md │ │ └── .articles │ │ │ └── config.json │ ├── scrabble-score │ │ ├── scrabble_score.py │ │ ├── .approaches │ │ │ ├── dictionary │ │ │ │ └── snippet.txt │ │ │ ├── nested-tuple │ │ │ │ └── snippet.txt │ │ │ ├── enum │ │ │ │ └── snippet.txt │ │ │ └── two-sequences │ │ │ │ └── snippet.txt │ │ └── .docs │ │ │ └── introduction.md │ ├── square-root │ │ ├── square_root.py │ │ └── .meta │ │ │ └── example.py │ ├── word-count │ │ ├── word_count.py │ │ ├── .meta │ │ │ └── example.py │ │ └── .docs │ │ │ └── introduction.md │ ├── anagram │ │ ├── anagram.py │ │ └── .meta │ │ │ └── example.py │ ├── bottle-song │ │ └── bottle_song.py │ ├── change │ │ └── change.py │ ├── eliuds-eggs │ │ ├── eliuds_eggs.py │ │ ├── .meta │ │ │ └── example.py │ │ └── .docs │ │ │ └── instructions.md │ ├── flatten-array │ │ └── flatten_array.py │ ├── ocr-numbers │ │ └── ocr_numbers.py │ ├── pascals-triangle │ │ ├── pascals_triangle.py │ │ └── .meta │ │ │ └── example.py │ ├── roman-numerals │ │ ├── roman_numerals.py │ │ └── .approaches │ │ │ ├── loop-over-romans │ │ │ └── snippet.txt │ │ │ ├── if-else │ │ │ └── snippet.txt │ │ │ └── itertools-starmap │ │ │ └── snippet.txt │ ├── saddle-points │ │ ├── saddle_points.py │ │ └── .meta │ │ │ └── additional_tests.json │ ├── spiral-matrix │ │ └── spiral_matrix.py │ ├── binary-search │ │ └── binary_search.py │ ├── collatz-conjecture │ │ ├── collatz_conjecture.py │ │ ├── .docs │ │ │ └── instructions.md │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ └── .approaches │ │ │ ├── if-else │ │ │ └── snippet.txt │ │ │ ├── recursion │ │ │ └── snippet.txt │ │ │ └── ternary-operator │ │ │ └── snippet.txt │ ├── crypto-square │ │ └── crypto_square.py │ ├── food-chain │ │ └── food_chain.py │ ├── hello-world │ │ ├── .meta │ │ │ ├── example.py │ │ │ └── tests.toml │ │ └── hello_world.py │ ├── knapsack │ │ └── knapsack.py │ ├── resistor-color-duo │ │ ├── resistor_color_duo.py │ │ └── .meta │ │ │ └── example.py │ ├── resistor-color-trio │ │ └── resistor_color_trio.py │ ├── rna-transcription │ │ ├── rna_transcription.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ ├── .meta │ │ │ └── example.py │ │ └── .approaches │ │ │ ├── translate-maketrans │ │ │ └── snippet.txt │ │ │ └── dictionary-join │ │ │ └── snippet.txt │ ├── rotational-cipher │ │ ├── rotational_cipher.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ └── .approaches │ │ │ ├── str-translate │ │ │ └── snippet.txt │ │ │ ├── ascii-values │ │ │ └── snippet.txt │ │ │ ├── alphabet │ │ │ └── snippet.txt │ │ │ └── recursion │ │ │ └── snippet.txt │ ├── secret-handshake │ │ ├── secret_handshake.py │ │ ├── .meta │ │ │ ├── plugins.py │ │ │ └── example.py │ │ └── .docs │ │ │ └── instructions.append.md │ ├── twelve-days │ │ └── twelve_days.py │ ├── accumulate │ │ ├── accumulate.py │ │ └── .meta │ │ │ └── example.py │ ├── matching-brackets │ │ ├── matching_brackets.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ ├── snippet.md │ │ │ │ └── code │ │ │ │ │ └── run_times.feather │ │ │ └── config.json │ │ ├── .approaches │ │ │ ├── repeated-substitution │ │ │ │ └── snippet.txt │ │ │ └── stack-match │ │ │ │ └── snippet.txt │ │ └── .docs │ │ │ └── instructions.md │ ├── protein-translation │ │ └── protein_translation.py │ ├── satellite │ │ └── satellite.py │ ├── armstrong-numbers │ │ ├── armstrong_numbers.py │ │ └── .meta │ │ │ └── example.py │ ├── robot-name │ │ ├── robot_name.py │ │ └── .approaches │ │ │ ├── mass-name-generation │ │ │ └── snippet.txt │ │ │ └── name-on-the-fly │ │ │ └── snippet.txt │ ├── all-your-base │ │ └── all_your_base.py │ ├── grains │ │ ├── grains.py │ │ ├── .approaches │ │ │ ├── pow │ │ │ │ └── snippet.txt │ │ │ ├── bit-shifting │ │ │ │ └── snippet.txt │ │ │ └── exponentiation │ │ │ │ └── snippet.txt │ │ ├── .articles │ │ │ ├── config.json │ │ │ └── performance │ │ │ │ └── snippet.md │ │ ├── .docs │ │ │ ├── introduction.md │ │ │ └── instructions.md │ │ └── .meta │ │ │ └── example.py │ ├── pythagorean-triplet │ │ ├── pythagorean_triplet.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── code │ │ │ │ │ ├── run_times.feather │ │ │ │ │ └── transposed_logs.feather │ │ │ └── config.json │ │ └── .approaches │ │ │ ├── quadratic │ │ │ └── snippet.txt │ │ │ └── cubic │ │ │ └── snippet.txt │ ├── resistor-color-expert │ │ └── resistor_color_expert.py │ ├── sum-of-multiples │ │ ├── sum_of_multiples.py │ │ ├── .meta │ │ │ └── example.py │ │ └── .docs │ │ │ ├── introduction.md │ │ │ └── instructions.append.md │ ├── swift-scheduling │ │ └── swift_scheduling.py │ ├── space-age │ │ └── space_age.py │ ├── two-bucket │ │ └── two_bucket.py │ ├── flower-field │ │ └── flower_field.py │ ├── high-scores │ │ ├── high_scores.py │ │ ├── .meta │ │ │ └── example.py │ │ └── .docs │ │ │ └── instructions.md │ ├── killer-sudoku-helper │ │ └── killer_sudoku_helper.py │ ├── largest-series-product │ │ ├── largest_series_product.py │ │ └── .docs │ │ │ └── introduction.md │ ├── minesweeper │ │ ├── minesweeper.py │ │ └── .docs │ │ │ └── introduction.md │ ├── phone-number │ │ └── phone_number.py │ ├── point-mutations │ │ ├── point_mutations.py │ │ └── .meta │ │ │ └── example.py │ ├── resistor-color │ │ ├── resistor_color.py │ │ └── .meta │ │ │ └── example.py │ ├── zebra-puzzle │ │ └── zebra_puzzle.py │ ├── forth │ │ └── forth.py │ ├── kindergarten-garden │ │ └── kindergarten_garden.py │ ├── atbash-cipher │ │ └── atbash_cipher.py │ ├── run-length-encoding │ │ └── run_length_encoding.py │ ├── strain │ │ ├── strain.py │ │ └── .meta │ │ │ └── example.py │ ├── luhn │ │ ├── luhn.py │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ └── .approaches │ │ │ ├── reversed-for │ │ │ └── snippet.txt │ │ │ ├── replace-reverse-enumerate │ │ │ └── snippet.txt │ │ │ └── recursion │ │ │ └── snippet.txt │ ├── affine-cipher │ │ └── affine_cipher.py │ ├── dnd-character │ │ └── dnd_character.py │ ├── variable-length-quantity │ │ └── variable_length_quantity.py │ ├── rail-fence-cipher │ │ └── rail_fence_cipher.py │ ├── connect │ │ ├── connect.py │ │ └── .meta │ │ │ └── template.j2 │ ├── triangle │ │ └── triangle.py │ ├── queen-attack │ │ └── queen_attack.py │ ├── circular-buffer │ │ └── .approaches │ │ │ ├── built-in-types │ │ │ └── snippet.txt │ │ │ └── standard-library │ │ │ └── snippet.txt │ ├── diffie-hellman │ │ ├── diffie_hellman.py │ │ └── .meta │ │ │ └── example.py │ ├── linked-list │ │ ├── linked_list.py │ │ └── .docs │ │ │ └── introduction.md │ ├── simple-linked-list │ │ └── .docs │ │ │ └── introduction.md │ ├── matrix │ │ └── matrix.py │ ├── difference-of-squares │ │ ├── difference_of_squares.py │ │ └── .meta │ │ │ └── example.py │ ├── simple-cipher │ │ └── simple_cipher.py │ ├── yacht │ │ ├── .approaches │ │ │ ├── if-structure │ │ │ │ └── snippet.txt │ │ │ ├── structural-pattern-matching │ │ │ │ └── snippet.txt │ │ │ └── functions │ │ │ │ └── snippet.txt │ │ └── yacht.py │ ├── scale-generator │ │ └── scale_generator.py │ ├── allergies │ │ └── allergies.py │ ├── rest-api │ │ └── rest_api.py │ ├── clock │ │ ├── .docs │ │ │ └── instructions.md │ │ └── clock.py │ ├── perfect-numbers │ │ └── perfect_numbers.py │ ├── sublist │ │ └── .approaches │ │ │ ├── using-strings │ │ │ └── snippet.txt │ │ │ └── list-manipulation │ │ │ └── snippet.txt │ ├── robot-simulator │ │ └── robot_simulator.py │ ├── palindrome-products │ │ ├── .articles │ │ │ ├── performance │ │ │ │ └── snippet.md │ │ │ └── config.json │ │ └── .approaches │ │ │ ├── nested-for-loop-optimized │ │ │ └── snippet.txt │ │ │ └── nested-for-loop │ │ │ └── snippet.txt │ ├── custom-set │ │ └── .docs │ │ │ └── instructions.md │ ├── grade-school │ │ ├── grade_school.py │ │ └── .docs │ │ │ └── instructions.append.md │ ├── complex-numbers │ │ └── .docs │ │ │ └── instructions.append.md │ ├── error-handling │ │ └── error_handling.py │ ├── bank-account │ │ └── bank_account.py │ ├── react │ │ └── react.py │ ├── word-search │ │ └── word_search.py │ └── meetup │ │ └── meetup.py ├── shared │ └── pytest.ini └── concept │ ├── pretty-leaflet │ └── string_formatting.py │ └── currency-exchange │ └── .meta │ └── design.md ├── pytest.ini ├── reference └── concepts │ ├── class_attributes.md │ ├── exceptions.md │ ├── everything_is_an_object.md │ ├── keyword_parameters.md │ ├── positional_parameters.md │ ├── set_comprehension.md │ ├── list_comprehension.md │ ├── dict_comprehension.md │ ├── inequality.md │ ├── builtin_functions │ ├── abs.md │ ├── all.md │ ├── any.md │ ├── bin.md │ ├── chr.md │ ├── dir.md │ ├── hex.md │ ├── id.md │ ├── map.md │ ├── oct.md │ ├── ord.md │ ├── pow.md │ ├── eval.md │ ├── exec.md │ ├── hash.md │ ├── help.md │ ├── iter.md │ ├── next.md │ ├── open.md │ ├── repr.md │ ├── vars.md │ ├── ascii.md │ ├── divmod.md │ ├── filter.md │ ├── format.md │ ├── input.md │ ├── locals.md │ ├── print.md │ ├── round.md │ ├── sorted.md │ ├── super.md │ ├── callable.md │ ├── compile.md │ ├── delattr.md │ ├── getattr.md │ ├── globals.md │ ├── hasattr.md │ ├── reversed.md │ ├── setattr.md │ ├── __import__.md │ ├── breakpoint.md │ ├── classmethod.md │ ├── isinstance.md │ ├── issubclass.md │ ├── staticmethod.md │ ├── max.md │ ├── min.md │ ├── sum.md │ └── enumerate.md │ ├── rich_comparison_methods.md │ ├── exception_handling.md │ ├── keyword_only_parameters.md │ ├── recursion.md │ ├── bitflags.md │ ├── positional_only_parameters.md │ ├── star_args.md │ ├── class_members.md │ ├── string_formatting.md │ ├── integer_comparison.md │ ├── iterators.md │ ├── short_circuiting.md │ ├── expressions.md │ ├── star_star_kwargs.md │ ├── docstrings.md │ ├── bracket_notation.md │ ├── equivalence.md │ ├── enumerated_values.md │ ├── exception_hierarchy.md │ ├── instance_properties.md │ ├── powers_of_two.md │ ├── type_conversion.md │ ├── binary_numbers.md │ ├── booleans_are_integers.md │ ├── data_structures.md │ ├── while_loops.md │ ├── operator_overloading.md │ ├── argument_unpacking.md │ ├── instance_attributes.md │ ├── order_of_evaluation.md │ ├── identity_testing.md │ ├── keywords │ ├── as.md │ ├── elif.md │ ├── else.md │ ├── from.md │ ├── except.md │ ├── finally.md │ ├── is.md │ ├── if.md │ ├── or.md │ ├── del.md │ ├── for.md │ ├── in.md │ ├── true.md │ ├── try.md │ ├── and.md │ ├── def.md │ ├── false.md │ ├── lambda.md │ ├── not.md │ ├── await.md │ ├── with.md │ ├── break.md │ ├── class.md │ ├── pass.md │ ├── raise.md │ ├── while.md │ ├── yield.md │ ├── assert.md │ ├── global.md │ ├── import.md │ ├── return.md │ └── async.md │ ├── method_overloading.md │ ├── operator_precedence.md │ ├── operators.md │ ├── list_methods.md │ ├── call_semantics.md │ ├── class_methods.md │ ├── builtin_types │ ├── memoryview.md │ ├── slice.md │ ├── complex.md │ └── type.md │ ├── function_signature.md │ ├── standard_library.md │ ├── lookup_efficiency.md │ ├── recursive_data_structures.md │ ├── initialization.md │ ├── generator_comprehension.md │ ├── generators.md │ ├── comparison_operators.md │ ├── default_arguments.md │ ├── exception_message.md │ ├── boolean_values.md │ ├── decorators_as_higher_order_functions.md │ ├── class_composition.md │ ├── immutability.md │ ├── exception_catching.md │ ├── modular_division.md │ ├── multiple_assignment.md │ ├── instantiation.md │ ├── comprehension_syntax.md │ └── constructor.md ├── docs ├── img │ ├── Anaconda-Conda-New.png │ ├── Windows-AddPythonPath.png │ ├── Spyder-Config-Interpreter.png │ ├── VSCode-EXT-Python-Header.png │ ├── Windows-SystemProperties.png │ ├── Windows-EnvironmentVariables.png │ ├── PyCharm-Config-InterpreterNew.png │ ├── PyCharm-Config-InterpreterDropDown.png │ └── VSCode-EXT-Python-SelectInterpreter-2.png └── SNIPPET.txt ├── requirements.txt ├── requirements-generator.txt ├── .gitignore ├── .github ├── CODEOWNERS ├── dependabot.yml └── workflows │ ├── configlet.yml │ ├── test-runner.yml │ └── pr-commenter.yml ├── .flake8 └── docker-compose.yml /concepts/none/links.json: -------------------------------------------------------------------------------- 1 | [] 2 | -------------------------------------------------------------------------------- /exercises/practice/bowling/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /concepts/none/about.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | -------------------------------------------------------------------------------- /concepts/bytes/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | -------------------------------------------------------------------------------- /exercises/practice/say/say.py: -------------------------------------------------------------------------------- 1 | def say(number): 2 | pass 3 | -------------------------------------------------------------------------------- /concepts/aliasing/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | -------------------------------------------------------------------------------- /concepts/bitflags/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | -------------------------------------------------------------------------------- /exercises/practice/darts/darts.py: -------------------------------------------------------------------------------- 1 | def score(x, y): 2 | pass 3 | -------------------------------------------------------------------------------- /concepts/binary-data/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | -------------------------------------------------------------------------------- /concepts/iteration/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/iterators/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/itertools/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/sequences/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/testing/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/bob/bob.py: -------------------------------------------------------------------------------- 1 | def response(hey_bob): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/diamond/diamond.py: -------------------------------------------------------------------------------- 1 | def rows(letter): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/leap/leap.py: -------------------------------------------------------------------------------- 1 | def leap_year(year): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/poker/poker.py: -------------------------------------------------------------------------------- 1 | def best_hands(hands): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/proverb/proverb.py: -------------------------------------------------------------------------------- 1 | def proverb(): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/sieve/sieve.py: -------------------------------------------------------------------------------- 1 | def primes(limit): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/two_fer.py: -------------------------------------------------------------------------------- 1 | def two_fer(name): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/wordy/wordy.py: -------------------------------------------------------------------------------- 1 | def answer(question): 2 | pass 3 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | markers = 3 | task: A concept exercise task. -------------------------------------------------------------------------------- /concepts/anonymous-functions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | -------------------------------------------------------------------------------- /concepts/collections/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/dataclasses/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/descriptors/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/memoryview/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/type-hinting/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/acronym/acronym.py: -------------------------------------------------------------------------------- 1 | def abbreviate(words): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/etl/etl.py: -------------------------------------------------------------------------------- 1 | def transform(legacy_data): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/gigasecond.py: -------------------------------------------------------------------------------- 1 | def add(moment): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/isogram/isogram.py: -------------------------------------------------------------------------------- 1 | def is_isogram(string): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/nth_prime.py: -------------------------------------------------------------------------------- 1 | def prime(number): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/octal/octal.py: -------------------------------------------------------------------------------- 1 | def parse_octal(digits): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/tournament/tournament.py: -------------------------------------------------------------------------------- 1 | def tally(rows): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/trinary/trinary.py: -------------------------------------------------------------------------------- 1 | def trinary(string): 2 | pass 3 | -------------------------------------------------------------------------------- /concepts/aliasing/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | -------------------------------------------------------------------------------- /concepts/bitflags/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | -------------------------------------------------------------------------------- /concepts/bytes/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/class-composition/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/class-customization/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/class-interfaces/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/functional-tools/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/list-comprehensions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/number-variations/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/regular-expressions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/rich-comparisons/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/text-processing/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/user-defined-errors/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/walrus-operator/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/alphametics/alphametics.py: -------------------------------------------------------------------------------- 1 | def solve(puzzle): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/book-store/book_store.py: -------------------------------------------------------------------------------- 1 | def total(basket): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/dominoes/dominoes.py: -------------------------------------------------------------------------------- 1 | def can_chain(dominoes): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/grep/grep.py: -------------------------------------------------------------------------------- 1 | def grep(pattern, flags, files): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/pangram/pangram.py: -------------------------------------------------------------------------------- 1 | def is_pangram(sentence): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/pig_latin.py: -------------------------------------------------------------------------------- 1 | def translate(text): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/raindrops.py: -------------------------------------------------------------------------------- 1 | def convert(number): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/series/series.py: -------------------------------------------------------------------------------- 1 | def slices(series, length): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/transpose/transpose.py: -------------------------------------------------------------------------------- 1 | def transpose(text): 2 | pass 3 | -------------------------------------------------------------------------------- /concepts/binary-data/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | -------------------------------------------------------------------------------- /concepts/generator-expressions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/higher-order-functions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/iteration/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/iterators/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/itertools/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/memoryview/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/operator-overloading/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/other-comprehensions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/sequences/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/string-methods-splitting/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/testing/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/with-statement/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | 4 | -------------------------------------------------------------------------------- /exercises/practice/beer-song/beer_song.py: -------------------------------------------------------------------------------- 1 | def recite(start, take=1): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/binary/binary.py: -------------------------------------------------------------------------------- 1 | def parse_binary(binary_string): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/hamming/hamming.py: -------------------------------------------------------------------------------- 1 | def distance(strand_a, strand_b): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/hexadecimal/hexadecimal.py: -------------------------------------------------------------------------------- 1 | def hexa(hex_string): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/house/house.py: -------------------------------------------------------------------------------- 1 | def recite(start_verse, end_verse): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/isbn-verifier/isbn_verifier.py: -------------------------------------------------------------------------------- 1 | def is_valid(isbn): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/prime-factors/prime_factors.py: -------------------------------------------------------------------------------- 1 | def factors(value): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/rectangles/rectangles.py: -------------------------------------------------------------------------------- 1 | def rectangles(strings): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/reverse_string.py: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/scrabble_score.py: -------------------------------------------------------------------------------- 1 | def score(word): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/square-root/square_root.py: -------------------------------------------------------------------------------- 1 | def square_root(number): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/word-count/word_count.py: -------------------------------------------------------------------------------- 1 | def count_words(sentence): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/shared/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | markers = 3 | task: A concept exercise task. -------------------------------------------------------------------------------- /reference/concepts/class_attributes.md: -------------------------------------------------------------------------------- 1 | # Class attributes 2 | 3 | TODO: ADD MORE 4 | -------------------------------------------------------------------------------- /concepts/anonymous-functions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | -------------------------------------------------------------------------------- /concepts/collections/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/context-manager-customization/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/dataclasses/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/descriptors/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/raising-and-handling-errors/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/text-processing/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/type-hinting/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/unicode-regular-expressions/about.md: -------------------------------------------------------------------------------- 1 | #TODO: Add about for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/walrus-operator/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/with-statement/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/anagram/anagram.py: -------------------------------------------------------------------------------- 1 | def find_anagrams(word, candidates): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/bottle-song/bottle_song.py: -------------------------------------------------------------------------------- 1 | def recite(start, take=1): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/change/change.py: -------------------------------------------------------------------------------- 1 | def find_fewest_coins(coins, target): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/eliuds_eggs.py: -------------------------------------------------------------------------------- 1 | def egg_count(display_value): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/flatten-array/flatten_array.py: -------------------------------------------------------------------------------- 1 | def flatten(iterable): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/ocr-numbers/ocr_numbers.py: -------------------------------------------------------------------------------- 1 | def convert(input_grid): 2 | pass 3 | 4 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/pascals_triangle.py: -------------------------------------------------------------------------------- 1 | def rows(row_count): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/roman_numerals.py: -------------------------------------------------------------------------------- 1 | def roman(number): 2 | pass 3 | 4 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/saddle_points.py: -------------------------------------------------------------------------------- 1 | def saddle_points(matrix): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/spiral-matrix/spiral_matrix.py: -------------------------------------------------------------------------------- 1 | def spiral_matrix(size): 2 | pass 3 | -------------------------------------------------------------------------------- /concepts/class-composition/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/class-customization/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/class-interfaces/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/functional-tools/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/list-comprehensions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/number-variations/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/operator-overloading/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/other-comprehensions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/regular-expressions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/rich-comparisons/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/user-defined-errors/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/binary-search/binary_search.py: -------------------------------------------------------------------------------- 1 | def find(search_list, value): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/collatz_conjecture.py: -------------------------------------------------------------------------------- 1 | def steps(number): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/crypto-square/crypto_square.py: -------------------------------------------------------------------------------- 1 | def cipher_text(plain_text): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/food-chain/food_chain.py: -------------------------------------------------------------------------------- 1 | def recite(start_verse, end_verse): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/example.py: -------------------------------------------------------------------------------- 1 | def hello(): 2 | return 'Hello, World!' 3 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/hello_world.py: -------------------------------------------------------------------------------- 1 | def hello(): 2 | return 'Goodbye, Mars!' 3 | -------------------------------------------------------------------------------- /exercises/practice/knapsack/knapsack.py: -------------------------------------------------------------------------------- 1 | def maximum_value(maximum_weight, items): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/resistor_color_duo.py: -------------------------------------------------------------------------------- 1 | def value(colors): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-trio/resistor_color_trio.py: -------------------------------------------------------------------------------- 1 | def label(colors): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/rna_transcription.py: -------------------------------------------------------------------------------- 1 | def to_rna(dna_strand): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/rotational_cipher.py: -------------------------------------------------------------------------------- 1 | def rotate(text, key): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/secret_handshake.py: -------------------------------------------------------------------------------- 1 | def commands(binary_str): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/twelve-days/twelve_days.py: -------------------------------------------------------------------------------- 1 | def recite(start_verse, end_verse): 2 | pass 3 | -------------------------------------------------------------------------------- /reference/concepts/exceptions.md: -------------------------------------------------------------------------------- 1 | # Exceptions 2 | 3 | This should be in the root reference. 4 | -------------------------------------------------------------------------------- /concepts/generator-expressions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/higher-order-functions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/string-methods-splitting/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/accumulate.py: -------------------------------------------------------------------------------- 1 | def accumulate(collection, operation): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/matching_brackets.py: -------------------------------------------------------------------------------- 1 | def is_paired(input_string): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/protein-translation/protein_translation.py: -------------------------------------------------------------------------------- 1 | def proteins(strand): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.meta/example.py: -------------------------------------------------------------------------------- 1 | def reverse(text=''): 2 | return text[::-1] 3 | -------------------------------------------------------------------------------- /exercises/practice/satellite/satellite.py: -------------------------------------------------------------------------------- 1 | def tree_from_traversals(preorder, inorder): 2 | pass 3 | -------------------------------------------------------------------------------- /concepts/context-manager-customization/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/raising-and-handling-errors/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /concepts/unicode-regular-expressions/introduction.md: -------------------------------------------------------------------------------- 1 | #TODO: Add introduction for this concept. 2 | 3 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/armstrong_numbers.py: -------------------------------------------------------------------------------- 1 | def is_armstrong_number(number): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/robot-name/robot_name.py: -------------------------------------------------------------------------------- 1 | class Robot: 2 | def __init__(self): 3 | pass 4 | -------------------------------------------------------------------------------- /docs/img/Anaconda-Conda-New.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/Anaconda-Conda-New.png -------------------------------------------------------------------------------- /exercises/practice/all-your-base/all_your_base.py: -------------------------------------------------------------------------------- 1 | def rebase(input_base, digits, output_base): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/grains/grains.py: -------------------------------------------------------------------------------- 1 | def square(number): 2 | pass 3 | 4 | 5 | def total(): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/pythagorean-triplet/pythagorean_triplet.py: -------------------------------------------------------------------------------- 1 | def triplets_with_sum(number): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-expert/resistor_color_expert.py: -------------------------------------------------------------------------------- 1 | def resistor_label(colors): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/sum_of_multiples.py: -------------------------------------------------------------------------------- 1 | def sum_of_multiples(limit, multiples): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/swift-scheduling/swift_scheduling.py: -------------------------------------------------------------------------------- 1 | def delivery_date(start, description): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.approaches/sequence-slicing/snippet.txt: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | return text[::-1] -------------------------------------------------------------------------------- /exercises/practice/space-age/space_age.py: -------------------------------------------------------------------------------- 1 | class SpaceAge: 2 | def __init__(self, seconds): 3 | pass 4 | -------------------------------------------------------------------------------- /exercises/practice/two-bucket/two_bucket.py: -------------------------------------------------------------------------------- 1 | def measure(bucket_one, bucket_two, goal, start_bucket): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/two-fer/.meta/example.py: -------------------------------------------------------------------------------- 1 | def two_fer(name='you'): 2 | return f'One for {name}, one for me.' 3 | -------------------------------------------------------------------------------- /docs/img/Windows-AddPythonPath.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/Windows-AddPythonPath.png -------------------------------------------------------------------------------- /exercises/practice/flower-field/flower_field.py: -------------------------------------------------------------------------------- 1 | def annotate(garden): 2 | # Function body starts here 3 | pass 4 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/high_scores.py: -------------------------------------------------------------------------------- 1 | class HighScores: 2 | def __init__(self, scores): 3 | pass 4 | -------------------------------------------------------------------------------- /exercises/practice/killer-sudoku-helper/killer_sudoku_helper.py: -------------------------------------------------------------------------------- 1 | def combinations(target, size, exclude): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/largest_series_product.py: -------------------------------------------------------------------------------- 1 | def largest_product(series, size): 2 | pass 3 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/minesweeper.py: -------------------------------------------------------------------------------- 1 | def annotate(minefield): 2 | # Function body starts here 3 | pass 4 | -------------------------------------------------------------------------------- /exercises/practice/phone-number/phone_number.py: -------------------------------------------------------------------------------- 1 | class PhoneNumber: 2 | def __init__(self, number): 3 | pass 4 | -------------------------------------------------------------------------------- /exercises/practice/point-mutations/point_mutations.py: -------------------------------------------------------------------------------- 1 | def hamming_distance(dna_strand_1, dna_strand_2): 2 | pass 3 | -------------------------------------------------------------------------------- /docs/img/Spyder-Config-Interpreter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/Spyder-Config-Interpreter.png -------------------------------------------------------------------------------- /docs/img/VSCode-EXT-Python-Header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/VSCode-EXT-Python-Header.png -------------------------------------------------------------------------------- /docs/img/Windows-SystemProperties.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/Windows-SystemProperties.png -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.meta/plugins.py: -------------------------------------------------------------------------------- 1 | def to_binary(num, digits=5): 2 | return bin(num)[2:].zfill(digits) 3 | -------------------------------------------------------------------------------- /reference/concepts/everything_is_an_object.md: -------------------------------------------------------------------------------- 1 | # Objects 2 | 3 | Explain "everything is an object". 4 | 5 | TODO: ADD MORE 6 | -------------------------------------------------------------------------------- /docs/img/Windows-EnvironmentVariables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/Windows-EnvironmentVariables.png -------------------------------------------------------------------------------- /exercises/practice/resistor-color/resistor_color.py: -------------------------------------------------------------------------------- 1 | def color_code(color): 2 | pass 3 | 4 | 5 | def colors(): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/zebra-puzzle/zebra_puzzle.py: -------------------------------------------------------------------------------- 1 | def drinks_water(): 2 | pass 3 | 4 | 5 | def owns_zebra(): 6 | pass 7 | -------------------------------------------------------------------------------- /docs/img/PyCharm-Config-InterpreterNew.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/PyCharm-Config-InterpreterNew.png -------------------------------------------------------------------------------- /exercises/practice/leap/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to determine whether a given year is a leap year. 4 | -------------------------------------------------------------------------------- /exercises/practice/leap/.meta/example.py: -------------------------------------------------------------------------------- 1 | def leap_year(year): 2 | return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) 3 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.approaches/built-in-reversed/snippet.txt: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | return (''.join(reversed(text))) 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | flake8~=5.0.4 2 | pylint~=2.17.1 3 | black<=22.3.0 4 | yapf~=0.32.0 5 | tomli>=1.1.0; python_full_version < '3.11.2' 6 | -------------------------------------------------------------------------------- /exercises/practice/forth/forth.py: -------------------------------------------------------------------------------- 1 | class StackUnderflowError(Exception): 2 | pass 3 | 4 | 5 | def evaluate(input_data): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/kindergarten-garden/kindergarten_garden.py: -------------------------------------------------------------------------------- 1 | class Garden: 2 | def __init__(self, diagram, students): 3 | pass 4 | -------------------------------------------------------------------------------- /docs/img/PyCharm-Config-InterpreterDropDown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/PyCharm-Config-InterpreterDropDown.png -------------------------------------------------------------------------------- /exercises/practice/atbash-cipher/atbash_cipher.py: -------------------------------------------------------------------------------- 1 | def encode(plain_text): 2 | pass 3 | 4 | 5 | def decode(ciphered_text): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/run-length-encoding/run_length_encoding.py: -------------------------------------------------------------------------------- 1 | def decode(string): 2 | pass 3 | 4 | 5 | def encode(string): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/strain/strain.py: -------------------------------------------------------------------------------- 1 | def keep(sequence, predicate): 2 | pass 3 | 4 | 5 | def discard(sequence, predicate): 6 | pass 7 | -------------------------------------------------------------------------------- /reference/concepts/keyword_parameters.md: -------------------------------------------------------------------------------- 1 | # Keyword parameters 2 | 3 | TODO: Explain the concept of keyword parameters in function signatures. 4 | -------------------------------------------------------------------------------- /docs/img/VSCode-EXT-Python-SelectInterpreter-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/docs/img/VSCode-EXT-Python-SelectInterpreter-2.png -------------------------------------------------------------------------------- /exercises/practice/leap/.approaches/calendar-isleap/snippet.txt: -------------------------------------------------------------------------------- 1 | from calendar import isleap 2 | 3 | def leap_year(year): 4 | return isleap(year) 5 | -------------------------------------------------------------------------------- /exercises/practice/luhn/luhn.py: -------------------------------------------------------------------------------- 1 | class Luhn: 2 | def __init__(self, card_num): 3 | pass 4 | 5 | def valid(self): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | # Performance 2 | 3 | Compare a variety of solutions using benchmarking data. 4 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.approaches/dictionary/snippet.txt: -------------------------------------------------------------------------------- 1 | def score(word): 2 | return sum(LETTER_SCORES[letter.upper()] for letter in word) -------------------------------------------------------------------------------- /exercises/practice/affine-cipher/affine_cipher.py: -------------------------------------------------------------------------------- 1 | def encode(plain_text, a, b): 2 | pass 3 | 4 | 5 | def decode(ciphered_text, a, b): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/dnd-character/dnd_character.py: -------------------------------------------------------------------------------- 1 | class Character: 2 | def __init__(self): 3 | pass 4 | 5 | def modifier(value): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/leap/.approaches/boolean-chain/snippet.txt: -------------------------------------------------------------------------------- 1 | def leap_year(year): 2 | return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) 3 | -------------------------------------------------------------------------------- /exercises/practice/leap/.approaches/ternary-operator/snippet.txt: -------------------------------------------------------------------------------- 1 | def leap_year(year): 2 | return not year % 400 if not year % 100 else not year % 4 3 | -------------------------------------------------------------------------------- /exercises/practice/square-root/.meta/example.py: -------------------------------------------------------------------------------- 1 | def square_root(number): 2 | n = 0 3 | while n ** 2 != number: 4 | n += 1 5 | return n 6 | -------------------------------------------------------------------------------- /exercises/practice/variable-length-quantity/variable_length_quantity.py: -------------------------------------------------------------------------------- 1 | def encode(numbers): 2 | pass 3 | 4 | 5 | def decode(bytes_): 6 | pass 7 | -------------------------------------------------------------------------------- /reference/concepts/positional_parameters.md: -------------------------------------------------------------------------------- 1 | # Positional parameters 2 | 3 | TODO: Explain the concept of positional parameters in function signatures. 4 | -------------------------------------------------------------------------------- /reference/concepts/set_comprehension.md: -------------------------------------------------------------------------------- 1 | # Set comprehension 2 | 3 | Explain the use of `{i for i in iterable}` to create _sets_. 4 | 5 | TODO: ADD MORE 6 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.meta/example.py: -------------------------------------------------------------------------------- 1 | from datetime import timedelta 2 | 3 | 4 | def add(moment): 5 | return moment + timedelta(seconds=1e9) 6 | -------------------------------------------------------------------------------- /reference/concepts/list_comprehension.md: -------------------------------------------------------------------------------- 1 | # List comprehension 2 | 3 | Explain the use of `[i for i in iterable]` to create _lists_. 4 | 5 | TODO: ADD MORE 6 | -------------------------------------------------------------------------------- /concepts/bytes/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/testing/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.approaches/set-len/snippet.txt: -------------------------------------------------------------------------------- 1 | def is_pangram(sentence): 2 | return len(set(ltr for ltr in sentence.lower() if ltr.isalpha())) == 26 3 | -------------------------------------------------------------------------------- /exercises/practice/point-mutations/.meta/example.py: -------------------------------------------------------------------------------- 1 | def hamming_distance(strand1, strand2): 2 | return sum(idx != edx for (idx, edx) in zip(strand1, strand2)) 3 | -------------------------------------------------------------------------------- /exercises/practice/rail-fence-cipher/rail_fence_cipher.py: -------------------------------------------------------------------------------- 1 | def encode(message, rails): 2 | pass 3 | 4 | 5 | def decode(encoded_message, rails): 6 | pass 7 | -------------------------------------------------------------------------------- /concepts/aliasing/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/binary-data/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/bitflags/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/collections/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/dataclasses/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/descriptors/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/iteration/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/iterators/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/itertools/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/memoryview/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/sequences/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/type-hinting/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/connect/connect.py: -------------------------------------------------------------------------------- 1 | 2 | class ConnectGame: 3 | def __init__(self, board): 4 | pass 5 | 6 | def get_winner(self): 7 | pass 8 | -------------------------------------------------------------------------------- /concepts/class-composition/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/class-interfaces/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/functional-tools/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/number-variations/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/rich-comparisons/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/text-processing/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/walrus-operator/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/with-statement/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.approaches/built-in-list-reverse/snippet.txt: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | output = list(text) 3 | output.reverse() 4 | 5 | return ''.join(output) -------------------------------------------------------------------------------- /reference/concepts/dict_comprehension.md: -------------------------------------------------------------------------------- 1 | # Dictionary comprehension 2 | 3 | Explain the use of `{k: v for k,v in iterable}` to create _dictionaries_. 4 | 5 | TODO: ADD MORE 6 | -------------------------------------------------------------------------------- /reference/concepts/inequality.md: -------------------------------------------------------------------------------- 1 | # Inequality 2 | 3 | TODO: ADD MORE 4 | 5 | - this solution checks if `a` is not equal to `b`. [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /requirements-generator.txt: -------------------------------------------------------------------------------- 1 | black<=22.3.0 2 | flake8~=5.0.4 3 | Jinja2~=3.1.2 4 | python-dateutil==2.8.1 5 | markupsafe==2.0.1 6 | tomli>=1.1.0; python_full_version < '3.11.2' 7 | -------------------------------------------------------------------------------- /concepts/anonymous-functions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/class-customization/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/generator-expressions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/higher-order-functions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/list-comprehensions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/operator-overloading/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/other-comprehensions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/regular-expressions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/user-defined-errors/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/armstrong-numbers/.meta/example.py: -------------------------------------------------------------------------------- 1 | def is_armstrong_number(number): 2 | return sum(pow(int(digit), len(str(number))) for digit in str(number)) == number 3 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Raindrops is a slightly more complex version of the FizzBuzz challenge, a classic interview question. 4 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | translate maketrans: 2.502872000914067e-07 3 | dictionary join: 1.0920033999718725e-06 4 | ``` 5 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.meta/example.py: -------------------------------------------------------------------------------- 1 | DNA_TO_RNA = str.maketrans("AGCT", "UCGA") 2 | 3 | def to_rna(dna_strand): 4 | return dna_strand.translate(DNA_TO_RNA) 5 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/abs.md: -------------------------------------------------------------------------------- 1 | # `abs` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#abs 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/all.md: -------------------------------------------------------------------------------- 1 | # `all` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#all 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/any.md: -------------------------------------------------------------------------------- 1 | # `any` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#any 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/bin.md: -------------------------------------------------------------------------------- 1 | # `bin` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#bin 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/chr.md: -------------------------------------------------------------------------------- 1 | # `chr` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#chr 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/dir.md: -------------------------------------------------------------------------------- 1 | # `dir` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#dir 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/hex.md: -------------------------------------------------------------------------------- 1 | # `hex` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#hex 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/id.md: -------------------------------------------------------------------------------- 1 | # `id` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#id 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/map.md: -------------------------------------------------------------------------------- 1 | # `map` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#map 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/oct.md: -------------------------------------------------------------------------------- 1 | # `oct` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#oct 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/ord.md: -------------------------------------------------------------------------------- 1 | # `ord` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#ord 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/pow.md: -------------------------------------------------------------------------------- 1 | # `pow` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#pow 8 | -------------------------------------------------------------------------------- /reference/concepts/rich_comparison_methods.md: -------------------------------------------------------------------------------- 1 | # Rich comparison methods 2 | 3 | TODO: ADD MORE 4 | 5 | - The `__eq__` method is overloaded [clock](../exercise-concepts/clock.md) 6 | -------------------------------------------------------------------------------- /concepts/raising-and-handling-errors/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/string-methods-splitting/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/unicode-regular-expressions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/triangle/triangle.py: -------------------------------------------------------------------------------- 1 | def equilateral(sides): 2 | pass 3 | 4 | 5 | def isosceles(sides): 6 | pass 7 | 8 | 9 | def scalene(sides): 10 | pass 11 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/eval.md: -------------------------------------------------------------------------------- 1 | # `eval` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#eval 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/exec.md: -------------------------------------------------------------------------------- 1 | # `exec` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#exec 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/hash.md: -------------------------------------------------------------------------------- 1 | # `hash` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#hash 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/help.md: -------------------------------------------------------------------------------- 1 | # `help` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#help 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/iter.md: -------------------------------------------------------------------------------- 1 | # `iter` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#iter 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/next.md: -------------------------------------------------------------------------------- 1 | # `next` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#next 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/open.md: -------------------------------------------------------------------------------- 1 | # `open` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#open 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/repr.md: -------------------------------------------------------------------------------- 1 | # `repr` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#repr 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/vars.md: -------------------------------------------------------------------------------- 1 | # `vars` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#vars 8 | -------------------------------------------------------------------------------- /reference/concepts/exception_handling.md: -------------------------------------------------------------------------------- 1 | # Exception handling 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise requires Exception handling [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/keyword_only_parameters.md: -------------------------------------------------------------------------------- 1 | # Keyword-only parameters 2 | 3 | TODO: Explain the concept of keyword-only parameters after the `*` punctuation in function signatures. 4 | -------------------------------------------------------------------------------- /concepts/context-manager-customization/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "TODO: add blurb for this concept", 3 | "authors": ["bethanyg", "cmccandless"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/queen-attack/queen_attack.py: -------------------------------------------------------------------------------- 1 | class Queen: 2 | def __init__(self, row, column): 3 | pass 4 | 5 | def can_attack(self, another_queen): 6 | pass 7 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.articles/performance/code/run_times.feather: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/exercises/practice/sieve/.articles/performance/code/run_times.feather -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/ascii.md: -------------------------------------------------------------------------------- 1 | # `ascii` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#ascii 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/divmod.md: -------------------------------------------------------------------------------- 1 | # `divmod` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#divmod 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/filter.md: -------------------------------------------------------------------------------- 1 | # `filter` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#filter 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/format.md: -------------------------------------------------------------------------------- 1 | # `format` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#format 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/input.md: -------------------------------------------------------------------------------- 1 | # `input` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#input 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/locals.md: -------------------------------------------------------------------------------- 1 | # `locals` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#locals 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/print.md: -------------------------------------------------------------------------------- 1 | # `print` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#print 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/round.md: -------------------------------------------------------------------------------- 1 | # `round` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#round 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/sorted.md: -------------------------------------------------------------------------------- 1 | # `sorted` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#sorted 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/super.md: -------------------------------------------------------------------------------- 1 | # `super` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#super 8 | -------------------------------------------------------------------------------- /reference/concepts/recursion.md: -------------------------------------------------------------------------------- 1 | # Recursion 2 | 3 | TODO: ADD MORE 4 | 5 | - recursion is a core concept in this exercise [binary-search-tree](../exercise-concepts/binary-search-tree.md) 6 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.meta/example.py: -------------------------------------------------------------------------------- 1 | from string import ascii_lowercase 2 | 3 | 4 | def is_pangram(sentence): 5 | return all(char in sentence.lower() for char in ascii_lowercase) 6 | -------------------------------------------------------------------------------- /reference/concepts/bitflags.md: -------------------------------------------------------------------------------- 1 | # Bitflags 2 | 3 | TODO: ADD MORE 4 | 5 | - a general understanding of bitflags is required to solve this exercise [allergies](../exercise-concepts/allergies.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/callable.md: -------------------------------------------------------------------------------- 1 | # `callable` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#callable 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/compile.md: -------------------------------------------------------------------------------- 1 | # `compile` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#compile 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/delattr.md: -------------------------------------------------------------------------------- 1 | # `delattr` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#delattr 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/getattr.md: -------------------------------------------------------------------------------- 1 | # `getattr` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#getattr 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/globals.md: -------------------------------------------------------------------------------- 1 | # `globals` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#globals 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/hasattr.md: -------------------------------------------------------------------------------- 1 | # `hasattr` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#hasattr 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/reversed.md: -------------------------------------------------------------------------------- 1 | # `reversed` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#reversed 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/setattr.md: -------------------------------------------------------------------------------- 1 | # `setattr` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#setattr 8 | -------------------------------------------------------------------------------- /reference/concepts/positional_only_parameters.md: -------------------------------------------------------------------------------- 1 | # Positional-only parameters 2 | 3 | TODO: Explain the concept of positional-only parameters before the `/` punctuation in function signatures. 4 | -------------------------------------------------------------------------------- /reference/concepts/star_args.md: -------------------------------------------------------------------------------- 1 | # `*args` for variadic arguments 2 | 3 | TODO: Explain the use of `*args` for collecting up an unknown number of positional arguments in function signatures. 4 | -------------------------------------------------------------------------------- /exercises/practice/bob/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | if statements: 2.4691750000056346e-07 3 | if statements nested: 2.3319310000078987e-07 4 | answer array: 2.5469370000064373e-07 5 | ``` 6 | -------------------------------------------------------------------------------- /exercises/practice/darts/.approaches/booleans-as-ints/snippet.txt: -------------------------------------------------------------------------------- 1 | def score(x_coord, y_coord): 2 | radius = (x_coord**2 + y_coord**2) 3 | return (radius<=1)*5 + (radius<=25)*4 +(radius<=100)*1 -------------------------------------------------------------------------------- /exercises/practice/sieve/.articles/performance/code/transposed_logs.feather: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/exercises/practice/sieve/.articles/performance/code/transposed_logs.feather -------------------------------------------------------------------------------- /reference/concepts/class_members.md: -------------------------------------------------------------------------------- 1 | # Class members 2 | 3 | TODO: ADD MORE 4 | 5 | - student must know how members of a class work [binary-search-tree](../exercise-concepts/binary-search-tree.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/string_formatting.md: -------------------------------------------------------------------------------- 1 | # String formatting 2 | 3 | TODO: ADD MORE 4 | 5 | - How to format strings, ie `%` operator, `str.format`, f-strings [clock](../exercise-concepts/clock.md) 6 | -------------------------------------------------------------------------------- /concepts/binary-octal-hexadecimal/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Other numerical systems in Python: binary (0b11), octal (0o71), and hex (0xFF)", 3 | "authors": ["BethanyG", "meatball133"] 4 | } 5 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.approaches/translate-maketrans/snippet.txt: -------------------------------------------------------------------------------- 1 | LOOKUP = str.maketrans("GCTA", "CGAU") 2 | 3 | 4 | def to_rna(dna_strand): 5 | return dna_strand.translate(LOOKUP) 6 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/__import__.md: -------------------------------------------------------------------------------- 1 | # `__import__` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#__import__ 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/breakpoint.md: -------------------------------------------------------------------------------- 1 | # `breakpoint` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#breakpoint 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/classmethod.md: -------------------------------------------------------------------------------- 1 | # `classmethod` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#classmethod 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/isinstance.md: -------------------------------------------------------------------------------- 1 | # `isinstance` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#isinstance 8 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/issubclass.md: -------------------------------------------------------------------------------- 1 | # `issubclass` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#issubclass 8 | -------------------------------------------------------------------------------- /reference/concepts/integer_comparison.md: -------------------------------------------------------------------------------- 1 | # Integer comparison 2 | 3 | TODO: ADD MORE 4 | 5 | - concept required to solve the exercise [binary-search-tree](../exercise-concepts/binary-search-tree.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/iterators.md: -------------------------------------------------------------------------------- 1 | # Iterators 2 | 3 | TODO: ADD MORE 4 | 5 | - the example solution for this exercise uses `zip()`, which returns an _iterator_. [matrix](../exercise-concepts/matrix.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/short_circuiting.md: -------------------------------------------------------------------------------- 1 | # Short circuiting 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise relies on short-circuiting to avoid unnecessary calculations [leap](../exercise-concepts/leap.md) 6 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.meta/example.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | def abbreviate(words): 5 | regex = "[A-Z]+['a-z]*|['a-z]+" 6 | return ''.join(word[0].upper() for word in re.findall(regex, words)) 7 | -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/.approaches/built-in-types/snippet.txt: -------------------------------------------------------------------------------- 1 | from queue import Queue 2 | 3 | class CircularBuffer: 4 | def __init__(self, capacity): 5 | self.buffer = Queue(capacity) 6 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a positive integer, return the number of steps it takes to reach 1 according to the rules of the Collatz Conjecture. 4 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.approaches/scrub-replace/snippet.txt: -------------------------------------------------------------------------------- 1 | def is_isogram(phrase): 2 | scrubbed = phrase.replace('-', '').replace(' ', '').lower() 3 | return len(scrubbed) == len(set(scrubbed)) 4 | -------------------------------------------------------------------------------- /exercises/practice/leap/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | if statements 2019: 8.861289999913425e-08 3 | ternary 2019: 1.0278620000462979e-07 4 | datetime add 2019: 6.689728000201284e-07 5 | ``` 6 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.articles/performance/code/run_times.feather: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/exercises/practice/matching-brackets/.articles/performance/code/run_times.feather -------------------------------------------------------------------------------- /exercises/practice/pangram/.approaches/all/snippet.txt: -------------------------------------------------------------------------------- 1 | from string import ascii_lowercase 2 | 3 | 4 | def is_pangram(sentence): 5 | return all(letter in sentence.lower() for letter in ascii_lowercase) 6 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/staticmethod.md: -------------------------------------------------------------------------------- 1 | # `staticmethod` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [docs][docs]. 6 | 7 | [docs]: https://docs.python.org/3/library/functions.html#staticmethod 8 | -------------------------------------------------------------------------------- /reference/concepts/expressions.md: -------------------------------------------------------------------------------- 1 | # Expressions 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise relies on writing an expression that will be evaluated to a return value [leap](../exercise-concepts/leap.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/star_star_kwargs.md: -------------------------------------------------------------------------------- 1 | # `**kwargs` for variadic keyword arguments 2 | 3 | TODO: Explain the use of `**kwargs` for collecting up a variable number of keyword arguments in function signatures. 4 | -------------------------------------------------------------------------------- /exercises/practice/bowling/bowling.py: -------------------------------------------------------------------------------- 1 | class BowlingGame: 2 | def __init__(self): 3 | pass 4 | 5 | def roll(self, pins): 6 | pass 7 | 8 | def score(self): 9 | pass 10 | -------------------------------------------------------------------------------- /exercises/practice/diffie-hellman/diffie_hellman.py: -------------------------------------------------------------------------------- 1 | def private_key(p): 2 | pass 3 | 4 | 5 | def public_key(p, g, private): 6 | pass 7 | 8 | 9 | def secret(p, public, private): 10 | pass 11 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/.meta/example.py: -------------------------------------------------------------------------------- 1 | def egg_count(display_value): 2 | eggs = 0 3 | while display_value: 4 | eggs += display_value % 2 5 | display_value //= 2 6 | return eggs 7 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.approaches/scrub-comprehension/snippet.txt: -------------------------------------------------------------------------------- 1 | def is_isogram(phrase): 2 | scrubbed = [ltr.lower() for ltr in phrase if ltr.isalpha()] 3 | return len(set(scrubbed)) == len(scrubbed) 4 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.meta/example.py: -------------------------------------------------------------------------------- 1 | def is_isogram(string): 2 | characters_lower = [char.lower() for char in string if char.isalpha()] 3 | return len(set(characters_lower)) == len(characters_lower) 4 | -------------------------------------------------------------------------------- /exercises/practice/pythagorean-triplet/.articles/performance/code/run_times.feather: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/exercises/practice/pythagorean-triplet/.articles/performance/code/run_times.feather -------------------------------------------------------------------------------- /reference/concepts/docstrings.md: -------------------------------------------------------------------------------- 1 | # Docstrings 2 | 3 | TODO: ADD MORE 4 | 5 | - used to document the function, normally situated right below `def func():` [reverse-string](../exercise-concepts/reverse-string.md) 6 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/regex-join/snippet.txt: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | def abbreviate(phrase): 4 | removed = re.findall(r"[a-zA-Z']+", phrase) 5 | 6 | return ''.join(word[0] for word in removed).upper() -------------------------------------------------------------------------------- /exercises/practice/circular-buffer/.approaches/standard-library/snippet.txt: -------------------------------------------------------------------------------- 1 | class CircularBuffer: 2 | def __init__(self, capacity: int) -> None: 3 | self.capacity = capacity 4 | self.content = [] 5 | -------------------------------------------------------------------------------- /exercises/practice/etl/.meta/example.py: -------------------------------------------------------------------------------- 1 | def transform(legacy_data): 2 | return { 3 | letter.lower(): points 4 | for points, letters in legacy_data.items() 5 | for letter in letters 6 | } 7 | -------------------------------------------------------------------------------- /exercises/practice/leap/.approaches/datetime-addition/snippet.txt: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | 4 | def leap_year(year): 5 | return (datetime.datetime(year, 2, 28) 6 | + datetime.timedelta(days=1)).day == 29 7 | -------------------------------------------------------------------------------- /exercises/practice/linked-list/linked_list.py: -------------------------------------------------------------------------------- 1 | class Node: 2 | def __init__(self, value, succeeding=None, previous=None): 3 | pass 4 | 5 | 6 | class LinkedList: 7 | def __init__(self): 8 | pass 9 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.approaches/iteration-and-concatenation/snippet.txt: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | output = '' 3 | for codepoint in text: 4 | output = codepoint + output 5 | return output 6 | -------------------------------------------------------------------------------- /exercises/practice/simple-linked-list/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a music streaming company. 4 | 5 | You've been tasked with creating a playlist feature for your music player application. 6 | -------------------------------------------------------------------------------- /reference/concepts/bracket_notation.md: -------------------------------------------------------------------------------- 1 | # Bracket notation 2 | 3 | TODO: ADD MORE 4 | 5 | - knowing that `[]` should be used to refer to a value at a specific index in a list [matrix](../exercise-concepts/matrix.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/equivalence.md: -------------------------------------------------------------------------------- 1 | # Equivalence 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise relies on the `==` and `!=` operators to check that two values are equivalent (or not) [leap](../exercise-concepts/leap.md) 6 | -------------------------------------------------------------------------------- /concepts/bitwise-operators/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Python supports bitwise operations such as left/right shift, and, or, xor, and not.", 3 | "authors": ["BethanyG", "colinleach"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.approaches/dictionary-join/snippet.txt: -------------------------------------------------------------------------------- 1 | LOOKUP = {"G": "C", "C": "G", "T": "A", "A": "U"} 2 | 3 | 4 | def to_rna(dna_strand): 5 | return ''.join(LOOKUP[chr] for chr in dna_strand) 6 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.approaches/comprehensions/snippet.txt: -------------------------------------------------------------------------------- 1 | def primes(limit): 2 | return [number for number in range(2, limit + 1) if 3 | all(number % divisor != 0 for divisor in range(2, number))] 4 | -------------------------------------------------------------------------------- /reference/concepts/enumerated_values.md: -------------------------------------------------------------------------------- 1 | # Enumerated values 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise relies on a fixed enumeration of possible values in a data structure [allergies](../exercise-concepts/allergies.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/exception_hierarchy.md: -------------------------------------------------------------------------------- 1 | # Exception hierarchy 2 | 3 | TODO: ADD MORE 4 | 5 | - the idiomatic `Exception` type is a `ValueError`, meaning the input is incorrect [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/instance_properties.md: -------------------------------------------------------------------------------- 1 | # Instance properties 2 | 3 | TODO: ADD MORE 4 | 5 | - this exercise requires one or more instance properties to persist passed in data. [matrix](../exercise-concepts/matrix.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/powers_of_two.md: -------------------------------------------------------------------------------- 1 | # Powers of two 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise relies on the use of powers of two in fundamental binary (bitwise) operations [allergies](../exercise-concepts/allergies.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/type_conversion.md: -------------------------------------------------------------------------------- 1 | # Type conversion 2 | 3 | TODO: ADD MORE 4 | 5 | - the passed in data is in `str` format but the output is expected as a list of type `int`. [matrix](../exercise-concepts/matrix.md) 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.beam 2 | *.pyc 3 | *.swp 4 | .DS_Store 5 | .ropeproject 6 | tmp 7 | bin/configlet 8 | bin/configlet.exe 9 | .idea/ 10 | .vscode/ 11 | .mypy_cache/ 12 | .cache 13 | .pytest_cache 14 | __pycache__ 15 | .venv 16 | -------------------------------------------------------------------------------- /concepts/recursion/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Recursion repeats code in a function by having the function call itself.", 3 | "authors": [ 4 | "bobahop" 5 | ], 6 | "contributors": ["bethanyg"] 7 | } 8 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | Steps with recursion : 4.1499966755509377e-05 3 | Steps with ternary : 2.1900050342082977e-05 4 | Steps with if/else : 2.0900042727589607e-05 5 | ``` 6 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.approaches/scrub-regex/snippet.txt: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | def is_isogram(phrase): 5 | scrubbed = re.compile('[^a-zA-Z]').sub('', phrase).lower() 6 | return len(set(scrubbed)) == len(scrubbed) 7 | -------------------------------------------------------------------------------- /exercises/practice/matrix/matrix.py: -------------------------------------------------------------------------------- 1 | class Matrix: 2 | def __init__(self, matrix_string): 3 | pass 4 | 5 | def row(self, index): 6 | pass 7 | 8 | def column(self, index): 9 | pass 10 | -------------------------------------------------------------------------------- /exercises/practice/pythagorean-triplet/.articles/performance/code/transposed_logs.feather: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/exercism/python/HEAD/exercises/practice/pythagorean-triplet/.articles/performance/code/transposed_logs.feather -------------------------------------------------------------------------------- /reference/concepts/binary_numbers.md: -------------------------------------------------------------------------------- 1 | # Binary numbers 2 | 3 | TODO: ADD MORE 4 | 5 | - binary numbers are a core important concept for this exercise [variable-length-quantity](../exercise-concepts/variable-length-quantity.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/booleans_are_integers.md: -------------------------------------------------------------------------------- 1 | # Booleans are integers 2 | 3 | TODO: ADD MORE 4 | 5 | - Booleans values are just named aliases for the integers 1 (`True`) and 0 (`False`) [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/data_structures.md: -------------------------------------------------------------------------------- 1 | # Data structures 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise requires the use of a collection like enum.Flag or collections.OrderedDict [allergies](../exercise-concepts/allergies.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/while_loops.md: -------------------------------------------------------------------------------- 1 | # While loops 2 | 3 | TODO: ADD MORE 4 | 5 | - the knowledge of `while` loops can be useful to solve this exercise [variable-length-quantity](../exercise-concepts/variable-length-quantity.md) 6 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Code owners 2 | .github/CODEOWNERS @exercism/maintainers-admin 3 | 4 | # Changes to `fetch-configlet` should be made in the `exercism/configlet` repo 5 | bin/fetch-configlet @exercism/maintainers-admin 6 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/difference_of_squares.py: -------------------------------------------------------------------------------- 1 | def square_of_sum(number): 2 | pass 3 | 4 | 5 | def sum_of_squares(number): 6 | pass 7 | 8 | 9 | def difference_of_squares(number): 10 | pass 11 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.approaches/findall-regex/snippet.txt: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | 4 | def is_isogram(phrase): 5 | scrubbed = "".join(re.findall("[a-zA-Z]", phrase)).lower() 6 | return len(set(scrubbed)) == len(scrubbed) 7 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.approaches/set-issubset/snippet.txt: -------------------------------------------------------------------------------- 1 | from string import ascii_lowercase 2 | 3 | ALPHABET = set(ascii_lowercase) 4 | 5 | 6 | def is_pangram(sentence): 7 | return ALPHABET.issubset(sentence.lower()) 8 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.approaches/nested-tuple/snippet.txt: -------------------------------------------------------------------------------- 1 | LETTERS_OF_SCORE = ( 2 | ("AEIOULNRST", 1), 3 | ("DG", 2), 4 | ("BCMP", 3), 5 | ("FHVWY", 4), 6 | ("K", 5), 7 | ("JX", 8), 8 | ("QZ", 10),) -------------------------------------------------------------------------------- /reference/concepts/operator_overloading.md: -------------------------------------------------------------------------------- 1 | # Operator overloading 2 | 3 | TODO: ADD MORE 4 | 5 | - How to overload the `+` and `-` operators using the `__add__` and `__sub__` special methods. [clock](../exercise-concepts/clock.md) 6 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 120 3 | exclude = 4 | .git, 5 | __pycache__, 6 | .pytest_cache, 7 | venv 8 | ignore = E501, F401 9 | format = pylint 10 | show-source = True 11 | max-complexity = 10 12 | 13 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | 5 | # Keep dependencies for GitHub Actions up-to-date 6 | - package-ecosystem: 'github-actions' 7 | directory: '/' 8 | schedule: 9 | interval: 'monthly' 10 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/list-comprehension/snippet.txt: -------------------------------------------------------------------------------- 1 | def abbreviate(to_abbreviate): 2 | phrase = to_abbreviate.replace('-', ' ').replace('_', ' ').upper().split() 3 | 4 | return ''.join([word[0] for word in phrase]) -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/map-function/snippet.txt: -------------------------------------------------------------------------------- 1 | def abbreviate(to_abbreviate): 2 | phrase = to_abbreviate.replace("_", " ").replace("-", " ").upper().split() 3 | 4 | return ''.join(map(lambda word: word[0], phrase)) -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/regex-sub/snippet.txt: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | def abbreviate_regex_sub(to_abbreviate): 4 | pattern = re.compile(r"(? 64: 3 | raise ValueError('square must be between 1 and 64') 4 | return pow(2, number - 1) 5 | 6 | 7 | def total(): 8 | return pow(2, 64) - 1 9 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | all: 1.8692991019000146e-05 3 | all: 1.686682232399926e-05 // with sentence.casefold() 4 | set: 2.5181135439997888e-06 5 | len: 5.848111433000668e-06 6 | bit: 1.2118699087000096e-05 7 | ``` 8 | -------------------------------------------------------------------------------- /reference/concepts/class_methods.md: -------------------------------------------------------------------------------- 1 | # Class methods 2 | 3 | TODO: ADD MORE 4 | 5 | - student must know how methods of a class work inside and outside the class, the use and meaning of `def` statement [binary-search-tree](../exercise-concepts/binary-search-tree.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/keywords/finally.md: -------------------------------------------------------------------------------- 1 | # `finally` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See [this blog post][keyword-finally-etymology] for more details. 6 | 7 | [keyword-finally-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#finally 8 | -------------------------------------------------------------------------------- /concepts/comparisons/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Comparison operators evaluate two operand values, returning 'True' or 'False' based on whether the comparison condition is met.", 3 | "authors": ["gurupratap-matharu", "bethanyg"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /concepts/fractions/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "The fractions module enables working with rational numbers, which preserve exact values and avoid the rounding errors common with floats.", 3 | "authors": ["BethanyG", "colinleach"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/grains/.approaches/bit-shifting/snippet.txt: -------------------------------------------------------------------------------- 1 | def square(number): 2 | if number < 1 or number > 64: 3 | raise ValueError('square must be between 1 and 64') 4 | return 1 << number - 1 5 | 6 | 7 | def total(): 8 | return (1 << 64) - 1 9 | -------------------------------------------------------------------------------- /exercises/practice/grains/.approaches/exponentiation/snippet.txt: -------------------------------------------------------------------------------- 1 | def square(number): 2 | if number < 1 or number > 64: 3 | raise ValueError('square must be between 1 and 64') 4 | return 2 ** (number - 1) 5 | 6 | 7 | def total(): 8 | return 2 ** 64 - 1 9 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.meta/example.py: -------------------------------------------------------------------------------- 1 | def distance(strand_a, strand_b): 2 | if len(strand_a) != len(strand_b): 3 | raise ValueError('Strands must be of equal length.') 4 | 5 | return sum(a_part != b_part for a_part, b_part in zip(strand_a, strand_b)) 6 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/if-statements/snippet.txt: -------------------------------------------------------------------------------- 1 | def convert(num): 2 | sounds = '' 3 | 4 | if num % 3 == 0: sounds += 'Pling' 5 | if num % 5 == 0: sounds += 'Plang' 6 | if num % 7 == 0: sounds += 'Plong' 7 | 8 | return sounds or str(num) -------------------------------------------------------------------------------- /exercises/practice/robot-name/.approaches/mass-name-generation/snippet.txt: -------------------------------------------------------------------------------- 1 | ... 2 | names = [l + n for l, n in product(letter_pairs, numbers)] 3 | shuffle(names) 4 | NAMES = iter(names) 5 | 6 | class Robot(object): 7 | def reset(self): 8 | self.name = next(NAMES) -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/loop/snippet.txt: -------------------------------------------------------------------------------- 1 | def abbreviate(to_abbreviate): 2 | phrase = to_abbreviate.replace('-', ' ').replace('_', ' ').upper().split() 3 | acronym = '' 4 | 5 | for word in phrase: 6 | acronym += word[0] 7 | 8 | return acronym -------------------------------------------------------------------------------- /exercises/practice/binary/.meta/example.py: -------------------------------------------------------------------------------- 1 | def parse_binary(digits): 2 | if set(digits) - set('01'): 3 | raise ValueError('Invalid binary literal: ' + digits) 4 | return sum(int(digit) * 2 ** idx 5 | for (idx, digit) in enumerate(reversed(digits))) 6 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | rotate ascii long : 0.000189200000022538 3 | rotate alphabet long : 0.0002604000037536025 4 | rotate translate long : 1.3999990187585354e-05 5 | rotate recursion long : 0.001309900006162934 6 | ``` 7 | -------------------------------------------------------------------------------- /exercises/practice/word-count/.meta/example.py: -------------------------------------------------------------------------------- 1 | import re 2 | from collections import Counter 3 | 4 | 5 | WORDS = re.compile("[a-z0-9]+(['][a-z]+)?") 6 | 7 | 8 | def count_words(text): 9 | return Counter(word.group(0) for word in WORDS.finditer(text.lower())) 10 | -------------------------------------------------------------------------------- /exercises/practice/luhn/.approaches/replace-reverse-enumerate/snippet.txt: -------------------------------------------------------------------------------- 1 | for pos, ltr in enumerate(num[::-1]): 2 | if not pos % 2: 3 | total+= int(ltr) 4 | else: 5 | total += Luhn.luhny_tune(int(ltr)) 6 | pos += 1 7 | return pos > 1 and not total % 10 8 | -------------------------------------------------------------------------------- /exercises/practice/perfect-numbers/perfect_numbers.py: -------------------------------------------------------------------------------- 1 | def classify(number): 2 | """ A perfect number equals the sum of its positive divisors. 3 | 4 | :param number: int a positive integer 5 | :return: str the classification of the input integer 6 | """ 7 | pass 8 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to reverse a given string. 4 | 5 | Some examples: 6 | 7 | - Turn `"stressed"` into `"desserts"`. 8 | - Turn `"strops"` into `"sports"`. 9 | - Turn `"racecar"` into `"racecar"`. 10 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | To keep things simple (and to let you focus on the important part of this exercise), your function will receive its inputs as binary strings: 2 | 3 | ``` 4 | >>> commands("00011") 5 | ["wink", "double blink"] 6 | ``` 7 | -------------------------------------------------------------------------------- /reference/concepts/builtin_types/memoryview.md: -------------------------------------------------------------------------------- 1 | # `memoryview` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python documentation entry for the [`memoryview`][docs-memoryview-type] type. 6 | 7 | [docs-memoryview-type]: https://docs.python.org/3/library/stdtypes.html#typememoryview 8 | -------------------------------------------------------------------------------- /exercises/practice/darts/.approaches/if-statements/snippet.txt: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | def score(x_coord, y_coord): 4 | distance = math.sqrt(x_coord**2 + y_coord**2) 5 | if distance <= 1: return 10 6 | if distance <= 5: return 5 7 | if distance <= 10: return 1 8 | return 0 -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.approaches/loop-over-romans/snippet.txt: -------------------------------------------------------------------------------- 1 | def roman(number): 2 | assert(number > 0) 3 | roman_num = "" 4 | for (k, v) in ROMANS: 5 | while k <= number: 6 | roman_num += v 7 | number -= k 8 | return roman_num 9 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.approaches/two-sequences/snippet.txt: -------------------------------------------------------------------------------- 1 | KEYS = "AEIOULNRSTDGBCMPFHVWYKJXQZ" 2 | SCORES = [1] * 10 + [2] * 2 + [3] * 4 + [4] * 5 + [5] * 1 + [8] * 2 +[10] * 2 3 | 4 | def score(word): 5 | return sum(SCORES[KEYS.index(letter.upper())] for letter in word) 6 | -------------------------------------------------------------------------------- /exercises/practice/sublist/.approaches/using-strings/snippet.txt: -------------------------------------------------------------------------------- 1 | # Failing approach 2 | def sublist(list_one, list_two): 3 | list_one_check = str(list_one).strip("[]") 4 | ... 5 | elif list_one_check in list_two_check: 6 | return SUBLIST 7 | ... 8 | return UNEQUAL -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.meta/example.py: -------------------------------------------------------------------------------- 1 | def sum_of_multiples(limit, multiples): 2 | return sum(value for value in range(limit) 3 | if any(value % multiple == 0 4 | for multiple in multiples 5 | if multiple > 0)) 6 | -------------------------------------------------------------------------------- /reference/concepts/function_signature.md: -------------------------------------------------------------------------------- 1 | # Function signature 2 | 3 | TODO: ADD MORE 4 | 5 | - functions take named arguments which are accessible within the body of the function; this one requires the student to make a function that accepts 2 [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/standard_library.md: -------------------------------------------------------------------------------- 1 | # Standard library 2 | 3 | TODO: ADD MORE 4 | 5 | - the `re` module is an example of the Python stdlib (standard library), or included code libraries and tools that are frequently used in Python [phone-number](../exercise-concepts/phone-number.md) 6 | -------------------------------------------------------------------------------- /exercises/practice/accumulate/.meta/example.py: -------------------------------------------------------------------------------- 1 | # [collection(x) for x in collection] would be nice but trivial 2 | 3 | 4 | def accumulate(collection, operation): 5 | response = [] 6 | for ellement in collection: 7 | response.append(operation(ellement)) 8 | return response 9 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/functools-reduce/snippet.txt: -------------------------------------------------------------------------------- 1 | from functools import reduce 2 | 3 | def abbreviate(to_abbreviate): 4 | phrase = to_abbreviate.replace("_", " ").replace("-", " ").upper().split() 5 | 6 | return reduce(lambda start, word: start + word[0], phrase, "") -------------------------------------------------------------------------------- /exercises/practice/darts/.approaches/match-case/snippet.txt: -------------------------------------------------------------------------------- 1 | from math import hypot, ceil 2 | 3 | def score(x, y): 4 | match ceil(hypot(x, y)): 5 | case 0 | 1: return 10 6 | case 2 | 3 | 4 | 5: return 5 7 | case 6 | 7 | 8 | 9 | 10: return 1 8 | case _: return 0 -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/itertools-compress/snippet.txt: -------------------------------------------------------------------------------- 1 | from itertools import compress 2 | 3 | def convert(number): 4 | sounds ='Pling','Plang','Plong' 5 | mask = ((number % factor) == 0 for factor in (3,5,7)) 6 | return ''.join(compress(sounds, mask)) or str(number) -------------------------------------------------------------------------------- /exercises/concept/pretty-leaflet/string_formatting.py: -------------------------------------------------------------------------------- 1 | def capitalize_header(event_name): 2 | pass 3 | 4 | def format_date(event_date): 5 | pass 6 | 7 | def display_icons(icons): 8 | pass 9 | 10 | def print_leaflet(event_name, icons, authors, event_date=None): 11 | pass 12 | -------------------------------------------------------------------------------- /exercises/practice/darts/.approaches/tuple-and-loop/snippet.txt: -------------------------------------------------------------------------------- 1 | def score(x_coord, y_coord): 2 | distance = x_coord**2 + y_coord**2 3 | rules = (1.0, 10), (25.0, 5), (100.0, 1), (200.0, 0) 4 | 5 | for distance, point in rules: 6 | if length <= distance: 7 | return point -------------------------------------------------------------------------------- /exercises/practice/yacht/.approaches/structural-pattern-matching/snippet.txt: -------------------------------------------------------------------------------- 1 | ONES = 1 2 | YACHT = 'YACHT' 3 | def score(dice, category): 4 | match category: 5 | case 1 | 2 | 3 | 4 | 5 | 6: 6 | return dice.count(category) * category 7 | case _: 8 | return 0 -------------------------------------------------------------------------------- /concepts/random/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "The random module contains functionality to generate random values for modelling, simulations and games. It should not be used for security or cryptographic applications.", 3 | "authors": ["BethanyG", "colinleach"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.approaches/sum/snippet.txt: -------------------------------------------------------------------------------- 1 | def distance(strand_a, strand_b): 2 | if len(strand_a) != len(strand_b): 3 | raise ValueError("Strands must be of equal length.") 4 | return sum(nucleotide_a != nucleotide_b for nucleotide_a, nucleotide_b in zip(strand_a, strand_b)) 5 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/truthy-and-falsey-with-fstring/snippet.txt: -------------------------------------------------------------------------------- 1 | def convert(number): 2 | threes = '' if number % 3 else 'Pling' 3 | fives = '' if number % 5 else 'Plang' 4 | sevens = '' if number % 7 else 'Plong' 5 | 6 | return f'{threes}{fives}{sevens}' or str(number) -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.approaches/str-translate/snippet.txt: -------------------------------------------------------------------------------- 1 | AlPHABET = "abcdefghijklmnopqrstuvwxyz" 2 | 3 | def rotate(text, key): 4 | translator = AlPHABET[key:] + AlPHABET[:key] 5 | return text.translate(str.maketrans(AlPHABET + AlPHABET.upper(), translator + translator.upper())) -------------------------------------------------------------------------------- /concepts/decorators/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Decorators are higher-order functions that take other functions as arguments to extend/modify their behavior and return the modified functions.", 3 | "authors": ["BethanyG", "bobahop", "kotp", "mathstrains21", "velaco"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/acronym/.approaches/generator-expression/snippet.txt: -------------------------------------------------------------------------------- 1 | def abbreviate(to_abbreviate): 2 | phrase = to_abbreviate.replace('-', ' ').replace('_', ' ').upper().split() 3 | 4 | # note the lack of square brackets around the comprehension. 5 | return ''.join(word[0] for word in phrase) -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/loop-and-fstring/snippet.txt: -------------------------------------------------------------------------------- 1 | def convert(number): 2 | sounds = '' 3 | drops = ("i", 3), ("a", 5), ("o", 7) 4 | 5 | for vowel, factor in drops: 6 | if number % factor == 0: 7 | sounds += f'Pl{vowel}ng' 8 | return sounds or str(number) -------------------------------------------------------------------------------- /exercises/practice/robot-simulator/robot_simulator.py: -------------------------------------------------------------------------------- 1 | # Globals for the directions 2 | # Change the values as you see fit 3 | EAST = None 4 | NORTH = None 5 | WEST = None 6 | SOUTH = None 7 | 8 | 9 | class Robot: 10 | def __init__(self, direction=NORTH, x_pos=0, y_pos=0): 11 | pass 12 | -------------------------------------------------------------------------------- /reference/concepts/lookup_efficiency.md: -------------------------------------------------------------------------------- 1 | # Lookup efficiency 2 | 3 | TODO: ADD MORE 4 | 5 | - an efficient solution requires knowing that membership testing is O(1) in **dict** and the **enum.Enum** variants, but is O(N) in **list** and other sequential types [allergies](../exercise-concepts/allergies.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/recursive_data_structures.md: -------------------------------------------------------------------------------- 1 | # Recursive data structures 2 | 3 | Data structures which refer to themselves, recursively. 4 | 5 | An example is found in [binary-search-tree][binary-search-tree]. 6 | TODO: ADD MORE 7 | 8 | [binary-search-tree]: ../exercise-concepts/binary-search-tree.md 9 | -------------------------------------------------------------------------------- /concepts/complex-numbers/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Complex numbers are a fundamental data type in Python, along with int and float. Further support is added with the cmath module, which is part of the Python standard library.", 3 | "authors": ["BethanyG", "colinleach"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/diffie-hellman/.meta/example.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | 4 | def private_key(p): 5 | return random.randint(2, p-1) 6 | 7 | 8 | def public_key(p, g, private): 9 | return pow(g, private, p) 10 | 11 | 12 | def secret(p, public, private): 13 | return pow(public, private, p) 14 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.approaches/tracking/snippet.txt: -------------------------------------------------------------------------------- 1 | def prime(number): 2 | counter = 2 3 | primes = [2] 4 | while len(primes) < number: 5 | counter += 1 6 | if all(counter % test != 0 for test in range(2, counter)): 7 | primes.append(counter) 8 | return primes[-1] -------------------------------------------------------------------------------- /.github/workflows/configlet.yml: -------------------------------------------------------------------------------- 1 | name: Configlet 2 | 3 | on: 4 | pull_request: 5 | push: 6 | branches: 7 | - main 8 | workflow_dispatch: 9 | 10 | permissions: 11 | contents: read 12 | 13 | jobs: 14 | configlet: 15 | uses: exercism/github-actions/.github/workflows/configlet.yml@main 16 | -------------------------------------------------------------------------------- /exercises/practice/scrabble-score/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | [Scrabble][wikipedia] is a word game where players place letter tiles on a board to form words. 4 | Each letter has a value. 5 | A word's score is the sum of its letters' values. 6 | 7 | [wikipedia]: https://en.wikipedia.org/wiki/Scrabble 8 | -------------------------------------------------------------------------------- /exercises/practice/bob/.approaches/answer-list/snippet.txt: -------------------------------------------------------------------------------- 1 | ANSWERS = ['Whatever.', 'Sure.', 'Whoa, chill out!', 2 | "Calm down, I know what I'm doing!"] 3 | # code snipped 4 | is_shout = 2 if hey_bob.isupper() else 0 5 | is_question = 1 if hey_bob.endswith('?') else 0 6 | return ANSWERS[is_shout + is_question] 7 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.approaches/bitfield/snippet.txt: -------------------------------------------------------------------------------- 1 | for ltr in phrase: 2 | letter = ord(ltr) 3 | if letter >= A_LCASE and letter <= Z_LCASE: 4 | if letter_flags & (1 << (letter - A_LCASE)) != 0: 5 | return False 6 | else: 7 | letter_flags |= 1 << (letter - A_LCASE) 8 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | scrubbed comprehension: 3.118929599993862e-06 3 | scrubbed replace: 9.586393000063253e-07 4 | scrubbed regex: 1.8171838999987813e-06 5 | findall regex: 4.059006099996623e-06 6 | bitfield: 5.4183307999919636e-06 7 | ``` 8 | -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | largest, min=100, max=100000 : 512.5731259000022 3 | largest_optimized, min=100, max=100000 : 0.013197900028899312 4 | smallest, min=100, max=100000 : 549.5989698000485 5 | smallest_optimized, min=100, max=100000 : 0.03933039994444698 6 | ``` 7 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/.approaches/sets-and-slices/snippet.txt: -------------------------------------------------------------------------------- 1 | for pos in range(1, len(word)): 2 | if word[pos] in VOWELS_Y: 3 | pos += 1 if word[pos] == 'u' and word[pos - 1] == "q" else 0 4 | piggyfied.append(word[pos:] + word[:pos] + "ay") 5 | break 6 | 7 | return " ".join(piggyfied) 8 | -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.approaches/list-and-join/snippet.txt: -------------------------------------------------------------------------------- 1 | def reverse(text): 2 | output = list(text) 3 | start, end = 0, len(text) - 1 4 | while start < end: 5 | output[start], output[end] = output[end], output[start] 6 | start += 1 7 | end -= 1 8 | return "".join(output) -------------------------------------------------------------------------------- /exercises/practice/sieve/.approaches/set-operations/snippet.txt: -------------------------------------------------------------------------------- 1 | def primes(number): 2 | not_prime = set() 3 | primes = [] 4 | for num in range(2, number+1): 5 | if num not in not_prime: 6 | primes.append(num) 7 | not_prime.update(range(num*num, number+1, num)) 8 | return primes -------------------------------------------------------------------------------- /exercises/practice/sieve/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | def primes(number): 2 | not_prime = set() 3 | primes = [] 4 | for num in range(2, number+1): 5 | if num not in not_prime: 6 | primes.append(num) 7 | not_prime.update(range (num*num, number+1, num)) 8 | return primes 9 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.approaches/recursion/snippet.txt: -------------------------------------------------------------------------------- 1 | def steps(number): 2 | if number < 1: 3 | raise ValueError("Only positive integers are allowed") 4 | if number == 1: 5 | return 0 6 | number = number / 2 if number % 2 == 0 else number * 3 + 1 7 | return 1 + steps(number) 8 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.approaches/generator-fun/snippet.txt: -------------------------------------------------------------------------------- 1 | from itertools import islice, count 2 | 3 | def prime(number): 4 | gen = islice(filter(lambda n: all(counter % test != 0 for test in range(2, int(counter ** 0.5) + 1)), count(2)), number) 5 | for _ in range(number - 1): next(gen) 6 | return next(gen) -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/.approaches/nested-for-loop-optimized/snippet.txt: -------------------------------------------------------------------------------- 1 | for number_a in range(max_factor, min_factor - 1,-1): 2 | was_bigger = False 3 | for number_b in range(max_factor, number_a - 1, -1): 4 | if number_a * number_b >= result: 5 | was_bigger = True 6 | -------------------------------------------------------------------------------- /reference/concepts/initialization.md: -------------------------------------------------------------------------------- 1 | # Initialization 2 | 3 | TODO: ADD MORE 4 | 5 | - customizing object instantiation with actions and persisting data. The example uses `__init__` to persist a `compass` object and x, y coordinates assigned to instance attributes. [robot-simulator](../exercise-concepts/robot-simulator.md) 6 | -------------------------------------------------------------------------------- /exercises/practice/hello-world/.meta/tests.toml: -------------------------------------------------------------------------------- 1 | # This is an auto-generated file. Regular comments will be removed when this 2 | # file is regenerated. Regenerating will not touch any manually added keys, 3 | # so comments can be added in a "comment" key. 4 | 5 | [af9ffe10-dc13-42d8-a742-e7bdafac449d] 6 | description = "Say Hi!" 7 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.approaches/repeated-substitution/snippet.txt: -------------------------------------------------------------------------------- 1 | def is_paired(text): 2 | text = "".join(element for element in text if element in "()[]{}") 3 | while "()" in text or "[]" in text or "{}" in text: 4 | text = text.replace("()","").replace("[]", "").replace("{}","") 5 | return not text -------------------------------------------------------------------------------- /exercises/practice/prime-factors/.meta/example.py: -------------------------------------------------------------------------------- 1 | def factors(value): 2 | factor_list = [] 3 | divisor = 2 4 | while value > 1: 5 | while value % divisor == 0: 6 | factor_list.append(divisor) 7 | value /= divisor 8 | 9 | divisor += 1 10 | 11 | return factor_list 12 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a company that makes an online, fantasy-survival game. 4 | 5 | When a player finishes a level, they are awarded energy points. 6 | The amount of energy awarded depends on which magical items the player found while exploring that level. 7 | -------------------------------------------------------------------------------- /exercises/practice/wordy/.approaches/regex-with-operator-module/snippet.txt: -------------------------------------------------------------------------------- 1 | while len(question) > 0: 2 | if REGEX['number'].match(question): 3 | raise ValueError("syntax error") 4 | 5 | question, operation = get_operation(question) 6 | question, num = get_number(question) 7 | 8 | result = operation(result, num) -------------------------------------------------------------------------------- /exercises/practice/darts/.approaches/dict-and-generator/snippet.txt: -------------------------------------------------------------------------------- 1 | def score(x_coord, y_coord): 2 | length = x_coord**2 + y_coord**2 3 | rules = {1.0: 10, 25.0: 5, 100.0: 1, 200: 0} 4 | score = max(point for 5 | distance, point in 6 | rules.items() if length <= distance) 7 | 8 | return score -------------------------------------------------------------------------------- /exercises/practice/pythagorean-triplet/.approaches/quadratic/snippet.txt: -------------------------------------------------------------------------------- 1 | def triplets_with_sum(n): 2 | triplets = [] 3 | for a in range(1, n + 1): 4 | for b in range(a + 1, n + 1): 5 | c = n - a - b 6 | if a ** 2 + b ** 2 == c ** 2: 7 | triplets.append([a, b, c]) 8 | return triplets -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/dict-and-join/snippet.txt: -------------------------------------------------------------------------------- 1 | def convert(number): 2 | sounds = {3: 'Pling', 5: 'Plang', 7: 'Plong'} 3 | 4 | results = ''.join(sounds[divisor] for 5 | divisor in sounds.keys() 6 | if number % divisor == 0) 7 | 8 | return results or str(number) 9 | -------------------------------------------------------------------------------- /exercises/practice/robot-name/.approaches/name-on-the-fly/snippet.txt: -------------------------------------------------------------------------------- 1 | cache = set() 2 | class Robot: 3 | def reset(self): 4 | while (name := ''.join(choices(ascii_uppercase, k=2) + choices(digits, k=3))) in cache: 5 | pass 6 | cache.add(name) 7 | self.name = name 8 | def __init__(self): self.reset() -------------------------------------------------------------------------------- /exercises/practice/sublist/.approaches/list-manipulation/snippet.txt: -------------------------------------------------------------------------------- 1 | def sublist(list_one, list_two): 2 | if list_one == list_two: 3 | return EQUAL 4 | if check_sub_sequences(list_one, list_two): 5 | return SUBLIST 6 | if check_sub_sequences(list_two, list_one): 7 | return SUPERLIST 8 | return UNEQUAL -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/max.md: -------------------------------------------------------------------------------- 1 | # `max` 2 | 3 | The `max` built-in function is a useful concept to solve the [hamming][hamming] exercise. 4 | 5 | TODO: ADD MORE DETAIL 6 | 7 | See [docs][docs]. 8 | 9 | [docs]: https://docs.python.org/3/library/functions.html#max 10 | [hamming]: ../../exercise-concepts/hamming.md 11 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/min.md: -------------------------------------------------------------------------------- 1 | # `min` 2 | 3 | The `min` built-in function is a useful concept to solve the [hamming][hamming] exercise. 4 | 5 | TODO: ADD MORE DETAIL 6 | 7 | See [docs][docs]. 8 | 9 | [docs]: https://docs.python.org/3/library/functions.html#min 10 | [hamming]: ../../exercise-concepts/hamming.md 11 | -------------------------------------------------------------------------------- /reference/concepts/generator_comprehension.md: -------------------------------------------------------------------------------- 1 | # Generator comprehension 2 | 3 | Explain the use of `(i for i in iterable)` to create _generators_. 4 | 5 | TODO: ADD MORE 6 | 7 | - a generator comprehension is passed to `sum()` to drive summation without storing all the values in a list first [hamming](../exercise-concepts/hamming.md) 8 | -------------------------------------------------------------------------------- /exercises/practice/anagram/.meta/example.py: -------------------------------------------------------------------------------- 1 | def find_anagrams(word, candidates): 2 | return [candidate 3 | for candidate in candidates 4 | if _letters(candidate) == _letters(word) 5 | if candidate.lower() != word.lower()] 6 | 7 | 8 | def _letters(word): 9 | return sorted(word.lower()) 10 | -------------------------------------------------------------------------------- /exercises/practice/custom-set/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Create a custom set type. 4 | 5 | Sometimes it is necessary to define a custom data structure of some type, like a set. 6 | In this exercise you will define your own set. 7 | How it works internally doesn't matter, as long as it behaves like a set of unique elements. 8 | -------------------------------------------------------------------------------- /exercises/practice/eliuds-eggs/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to count the number of 1 bits in the binary representation of a number. 4 | 5 | ## Restrictions 6 | 7 | Keep your hands off that bit-count functionality provided by your standard library! 8 | Solve this one yourself using other basic tools instead. 9 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/grade_school.py: -------------------------------------------------------------------------------- 1 | class School: 2 | def __init__(self): 3 | pass 4 | 5 | def add_student(self, name, grade): 6 | pass 7 | 8 | def roster(self): 9 | pass 10 | 11 | def grade(self, grade_number): 12 | pass 13 | 14 | def added(self): 15 | pass 16 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.approaches/ascii-values/snippet.txt: -------------------------------------------------------------------------------- 1 | for letter in text: 2 | if letter.isalpha(): 3 | if letter.isupper(): 4 | result += chr((ord(letter) - 65 + key) % 26 + 65) 5 | else: 6 | result += chr((ord(letter) - 97 + key) % 26 + 97) 7 | else: 8 | result += letter -------------------------------------------------------------------------------- /concepts/binary-octal-hexadecimal/links.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "url": "https://towardsdatascience.com/binary-hex-and-octal-in-python-20222488cee1", 4 | "description": "Binary, octal, hex in python" 5 | }, 6 | { 7 | "url": "https://en.wikipedia.org/wiki/Numeral_system", 8 | "description": "Numeral system" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.approaches/ternary-operator/snippet.txt: -------------------------------------------------------------------------------- 1 | def steps(number): 2 | if number <= 0: 3 | raise ValueError("Only positive integers are allowed") 4 | counter = 0 5 | while number != 1: 6 | number = number / 2 if number % 2 == 0 else number * 3 + 1 7 | counter += 1 8 | return counter -------------------------------------------------------------------------------- /exercises/practice/complex-numbers/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | # Instructions append 2 | 3 | ## Building a Numeric Type 4 | 5 | See [Emulating numeric types][emulating-numeric-types] for help on operator overloading and customization. 6 | 7 | [emulating-numeric-types]: https://docs.python.org/3/reference/datamodel.html#emulating-numeric-types 8 | -------------------------------------------------------------------------------- /exercises/practice/say/.meta/additional_tests.json: -------------------------------------------------------------------------------- 1 | { 2 | "cases": [ 3 | { 4 | "description": "one hundred seventy", 5 | "property": "say", 6 | "input": { 7 | "number": 170 8 | }, 9 | "expected": "one hundred seventy" 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /exercises/practice/secret-handshake/.meta/example.py: -------------------------------------------------------------------------------- 1 | GESTURES = ['jump', 'close your eyes', 'double blink', 'wink'] 2 | 3 | 4 | def commands(binary_str): 5 | reverse, *bits = [digit == '1' for digit in binary_str] 6 | actions = [gesture for gesture, bit in zip(GESTURES, bits) if bit] 7 | return actions if reverse else actions[::-1] 8 | -------------------------------------------------------------------------------- /exercises/practice/wordy/.approaches/dunder-getattribute/snippet.txt: -------------------------------------------------------------------------------- 1 | while len(ret) > 1: 2 | try: 3 | x, op, y, *tail = ret 4 | if op not in OPS.values(): raise ValueError("syntax error") 5 | ret = [int(x).__getattribute__(op)(int(y)), *tail] 6 | except: 7 | raise ValueError("syntax error") 8 | return ret[0] 9 | -------------------------------------------------------------------------------- /reference/concepts/generators.md: -------------------------------------------------------------------------------- 1 | # Generators 2 | 3 | TODO: ADD MORE 4 | 5 | - generators calculate then `yield` a value one at a time, as opposed to lists which calculate and return all values in memory at once. A generator will pick up where it leaves off, and generate one item at a time, on demand [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /exercises/practice/linked-list/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You are working on a project to develop a train scheduling system for a busy railway network. 4 | 5 | You've been asked to develop a prototype for the train routes in the scheduling system. 6 | Each route consists of a sequence of train stations that a given train stops at. 7 | -------------------------------------------------------------------------------- /exercises/practice/luhn/.approaches/recursion/snippet.txt: -------------------------------------------------------------------------------- 1 | head, *tail = chars 2 | if head.isdigit(): 3 | if not pos % 2: 4 | return Luhn.luhny_bin(pos + 1, sum + int(head), tail) 5 | else: 6 | return Luhn.luhny_bin(pos + 1, sum + Luhn.luhny_tune(int(head)), tail) 7 | if head == " ": 8 | return Luhn.luhny_bin(pos, sum, tail) 9 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/sequence-with-join/snippet.txt: -------------------------------------------------------------------------------- 1 | def convert(number): 2 | drops = ["Pling","Plang","Plong"] 3 | factors = [3,5,7] 4 | sounds = ''.join(drops[index] for 5 | index, factor in 6 | enumerate(factors) if (number % factor == 0)) 7 | 8 | return sounds or str(number) -------------------------------------------------------------------------------- /exercises/practice/transpose/.meta/example.py: -------------------------------------------------------------------------------- 1 | def transpose(lines): 2 | rows = [row.replace(' ', '_') for row in lines.splitlines()] 3 | rows = [row.ljust(len(max(rows, key=len))) for row in rows] 4 | rows = [''.join(row) for row in zip(*rows)] 5 | rows = [row.rstrip().replace('_', ' ') for row in rows] 6 | return '\n'.join(rows) 7 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.approaches/range/snippet.txt: -------------------------------------------------------------------------------- 1 | def distance(strand_a, strand_b): 2 | if len(strand_a) != len(strand_b): 3 | raise ValueError("Strands must be of equal length.") 4 | count = 0 5 | for index in range(len(strand_a)): 6 | if strand_a[index] != strand_b[index]: 7 | count += 1 8 | return count 9 | -------------------------------------------------------------------------------- /exercises/practice/minesweeper/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | [Minesweeper][wikipedia] is a popular game where the user has to find the mines using numeric hints that indicate how many mines are directly adjacent (horizontally, vertically, diagonally) to a square. 4 | 5 | [wikipedia]: https://en.wikipedia.org/wiki/Minesweeper_(video_game) 6 | -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/.approaches/nested-for-loop/snippet.txt: -------------------------------------------------------------------------------- 1 | for number_a in range(min_factor, max_factor+1): 2 | for number_b in range(min_factor, max_factor+1): 3 | if number_a * number_b >= result: 4 | test_value = str(number_a * number_b) 5 | if test_value == test_value[::-1]: 6 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color-duo/.meta/example.py: -------------------------------------------------------------------------------- 1 | COLORS = [ 2 | 'black', 3 | 'brown', 4 | 'red', 5 | 'orange', 6 | 'yellow', 7 | 'green', 8 | 'blue', 9 | 'violet', 10 | 'grey', 11 | 'white' 12 | ] 13 | 14 | 15 | def value(colors): 16 | return 10 * COLORS.index(colors[0]) + COLORS.index(colors[1]) 17 | -------------------------------------------------------------------------------- /exercises/practice/error-handling/error_handling.py: -------------------------------------------------------------------------------- 1 | def handle_error_by_throwing_exception(): 2 | pass 3 | 4 | 5 | def handle_error_by_returning_none(input_data): 6 | pass 7 | 8 | 9 | def handle_error_by_returning_tuple(input_data): 10 | pass 11 | 12 | 13 | def filelike_objects_are_closed_on_exception(filelike_object): 14 | pass 15 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a string containing brackets `[]`, braces `{}`, parentheses `()`, or any combination thereof, verify that any and all pairs are matched and nested correctly. 4 | Any other characters should be ignored. 5 | For example, `"{what is (42)}?"` is balanced and `"[text}"` is not. 6 | -------------------------------------------------------------------------------- /concepts/dict-methods/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "The dict class in Python provides many useful methods for working with dictionaries. Some are introduced in the concept for dicts. This concept tackles a few more - along with some techniques for iterating through and manipulating dicts.", 3 | "authors": ["bethanyg", "valentin-p"], 4 | "contributors": [] 5 | } -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.approaches/alphabet/snippet.txt: -------------------------------------------------------------------------------- 1 | for letter in text: 2 | if letter.isalpha(): 3 | if letter.isupper(): 4 | result += AlPHABET[(AlPHABET.index(letter.lower()) + key) % 26].upper() 5 | else: 6 | result += AlPHABET[(AlPHABET.index(letter) + key) % 26] 7 | else: 8 | result += letter -------------------------------------------------------------------------------- /reference/concepts/comparison_operators.md: -------------------------------------------------------------------------------- 1 | # Comparison operators 2 | 3 | TODO: ADD MORE 4 | 5 | - concept required to solve the exercise, `==`, `>`, `<` [variable-length-quantity](../exercise-concepts/variable-length-quantity.md) 6 | - the exercise relies on the `==` and `!=` operators to make binary comparisons between values [leap](../exercise-concepts/leap.md) 7 | -------------------------------------------------------------------------------- /reference/concepts/default_arguments.md: -------------------------------------------------------------------------------- 1 | # Default arguments 2 | 3 | TODO: ADD MORE 4 | 5 | - pre-setting function arguments to protect against them not being passed by a caller. The example uses `direction = NORTH` and `x=0, y=0` to ensure those values for a `robot` even if they are not initially passed. [robot-simulator](../exercise-concepts/robot-simulator.md) 6 | -------------------------------------------------------------------------------- /concepts/bools/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Python represents true and false values with the 'bool' type. There are only two values: 'True' and 'False'. These values can be bound to a variable, used in comparisons, or returned from a function. Bools are a subclass of 'int'.", 3 | "authors": ["neenjaw"], 4 | "contributors": ["cmccandless", "BethanyG"] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/bob/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "7b04a95b-d56f-48d3-bb79-3523cfee44ad", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach for Bob's response.", 8 | "authors": ["bobahop"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/hamming/.approaches/zip/snippet.txt: -------------------------------------------------------------------------------- 1 | def distance(strand_a, strand_b): 2 | if len(strand_a) != len(strand_b): 3 | raise ValueError("Strands must be of equal length.") 4 | count = 0 5 | for nucleotide_a, nucleotide_b in zip(strand_a, strand_b): 6 | if nucleotide_a != nucleotide_b: 7 | count += 1 8 | return count 9 | -------------------------------------------------------------------------------- /exercises/practice/luhn/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "fa3d646c-b075-49a4-80b7-b339f9022aea", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach to validating Luhn.", 8 | "authors": ["bobahop"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/pythagorean-triplet/.approaches/cubic/snippet.txt: -------------------------------------------------------------------------------- 1 | def triplets_with_sum(n): 2 | triplets = [] 3 | for a in range(1, n + 1): 4 | for b in range(a + 1, n + 1): 5 | for c in range(b + 1, n + 1): 6 | if a**2 + b**2 == c**2 and a + b + c == n: 7 | triplets.append([a, b, c]) 8 | return triplets -------------------------------------------------------------------------------- /exercises/practice/raindrops/.approaches/functools-reduce/snippet.txt: -------------------------------------------------------------------------------- 1 | from functools import reduce 2 | 3 | def convert(number): 4 | sounds = ('Pling','Plang','Plong') 5 | factors = ((number % factor) == 0 for factor in (3,5,7)) 6 | result = reduce(lambda sound, item : sound + (item[0] * item[1]), zip(sounds, factors), '') 7 | 8 | return result or str(number) -------------------------------------------------------------------------------- /reference/concepts/exception_message.md: -------------------------------------------------------------------------------- 1 | # Exception message 2 | 3 | TODO: ADD MORE 4 | 5 | - the user can use a custom error message inside the mentioned `ValueError` [variable-length-quantity](../exercise-concepts/variable-length-quantity.md) 6 | - Custom error messages can (and should) be supplied to an Exception when raised [hamming](../exercise-concepts/hamming.md) 7 | -------------------------------------------------------------------------------- /exercises/practice/grains/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "5fa8743e-3740-4e1e-b9d7-bda6856c3a08", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach to calculating Grains.", 8 | "authors": ["bobahop"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/resistor-color/.meta/example.py: -------------------------------------------------------------------------------- 1 | COLORS = [ 2 | 'black', 3 | 'brown', 4 | 'red', 5 | 'orange', 6 | 'yellow', 7 | 'green', 8 | 'blue', 9 | 'violet', 10 | 'grey', 11 | 'white' 12 | ] 13 | 14 | 15 | def color_code(color): 16 | return COLORS.index(color) 17 | 18 | 19 | def colors(): 20 | return COLORS 21 | -------------------------------------------------------------------------------- /exercises/practice/sum-of-multiples/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | # Instructions append 2 | 3 | You can make the following assumptions about the inputs to the 4 | `sum_of_multiples` function: 5 | * All input numbers are non-negative `int`s, i.e. natural numbers 6 | including zero. 7 | * A list of factors must be given, and its elements are unique 8 | and sorted in ascending order. -------------------------------------------------------------------------------- /reference/concepts/builtin_types/slice.md: -------------------------------------------------------------------------------- 1 | # `slice` 2 | 3 | An internal type you usually won't notice directly, but under the hood it's used whenever you use [slicing][slicing] syntax. 4 | 5 | See the Python documentation entry for the [`slice`][docs-slice] function. 6 | 7 | [slicing]: ../slicing.md 8 | [docs-slice]: https://docs.python.org/3/library/functions.html#slice 9 | -------------------------------------------------------------------------------- /.github/workflows/test-runner.yml: -------------------------------------------------------------------------------- 1 | name: Test Runner 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | 9 | jobs: 10 | test-runner: 11 | runs-on: ubuntu-22.04 12 | steps: 13 | - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 14 | - name: Run test-runner 15 | run: docker compose run test-runner 16 | -------------------------------------------------------------------------------- /exercises/practice/isogram/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "c933d353-8857-48f9-bac3-1ac752676390", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach to determining an isogram.", 8 | "authors": ["bobahop"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a number n, determine what the nth prime is. 4 | 5 | By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. 6 | 7 | If your language provides methods in the standard library to deal with prime numbers, pretend they don't exist and implement them yourself. 8 | -------------------------------------------------------------------------------- /exercises/practice/nth-prime/.meta/additional_tests.json: -------------------------------------------------------------------------------- 1 | { 2 | "cases": [ 3 | { 4 | "description": "first twenty primes", 5 | "property": "primeRange", 6 | "input": { 7 | "number": 20 8 | }, 9 | "expected": [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 10 | 37, 41, 43, 47, 53, 59, 61, 67, 71] 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /exercises/practice/wordy/.approaches/functools-reduce/snippet.txt: -------------------------------------------------------------------------------- 1 | OPERATORS = {"plus": add, "minus": sub, "multiplied": mul, "divided": div} 2 | 3 | operations = question[1::2] 4 | digits = [int(element) if (element.isdigit() or element[1:].isdigit()) 5 | else None for element in question[::2]] 6 | ... 7 | return reduce(lambda x, y: OPERATORS[operations.pop(0)](x, y), digits) -------------------------------------------------------------------------------- /reference/concepts/keywords/is.md: -------------------------------------------------------------------------------- 1 | # `is` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-is-docs], as well as [this blog post][keyword-is-etymology] for more details. 6 | 7 | [keyword-is-docs]: https://docs.python.org/3/reference/expressions.html#is 8 | [keyword-is-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#is 9 | -------------------------------------------------------------------------------- /.github/workflows/pr-commenter.yml: -------------------------------------------------------------------------------- 1 | name: "PR Commenter" 2 | on: 3 | - pull_request_target 4 | 5 | jobs: 6 | pr-comment: 7 | runs-on: ubuntu-24.04 8 | steps: 9 | - uses: exercism/pr-commenter-action@085ef62d2a541a112c3ade1d24deea83665ea186 10 | with: 11 | github-token: "${{ github.token }}" 12 | config-file: ".github/pr-commenter.yml" -------------------------------------------------------------------------------- /exercises/practice/acronym/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "4c0e0a02-0bc0-4921-8016-20b0ae57804a", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach to forming an acronym.", 8 | "authors": ["bethanyg, colinleach"] 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /exercises/practice/grains/.articles/performance/snippet.md: -------------------------------------------------------------------------------- 1 | ``` 2 | bit shifting square 64: 1.2760140001773835e-07 3 | bit shifting total 64: 6.096410000463947e-08 4 | exponentiation square 64: 4.122742000035942e-07 5 | exponentiation total 64: 6.094090000260621e-08 6 | pow square 64: 4.2468130000634117e-07 7 | pow total 64: 3.1965399999171494e-07 8 | ``` 9 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/.meta/example.py: -------------------------------------------------------------------------------- 1 | class HighScores: 2 | def __init__(self, scores): 3 | self.scores = scores 4 | 5 | def latest(self): 6 | return self.scores[-1] 7 | 8 | def personal_best(self): 9 | return max(self.scores) 10 | 11 | def personal_top_three(self): 12 | return sorted(self.scores, reverse=True)[:3] 13 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.meta/example.py: -------------------------------------------------------------------------------- 1 | def primes(limit): 2 | prime = [True] * (limit + 1) 3 | prime[0] = prime[1] = False 4 | for idx in range(2, int(limit ** 0.5) + 1): 5 | if prime[idx]: 6 | for edx in range(idx * idx, limit + 1, idx): 7 | prime[edx] = False 8 | 9 | return [edx for edx, idx in enumerate(prime) if idx] 10 | -------------------------------------------------------------------------------- /reference/concepts/boolean_values.md: -------------------------------------------------------------------------------- 1 | # Boolean values 2 | 3 | TODO: ADD MORE 4 | 5 | - this solution uses Boolean values (`True` / `False`) [hamming](../exercise-concepts/hamming.md) 6 | - True and False of type `bool`. The example solution uses `True` and `False` as return values from functions that test membership in a list of values. [markdown](../exercise-concepts/markdown.md) 7 | -------------------------------------------------------------------------------- /exercises/practice/bank-account/bank_account.py: -------------------------------------------------------------------------------- 1 | class BankAccount: 2 | def __init__(self): 3 | pass 4 | 5 | def get_balance(self): 6 | pass 7 | 8 | def open(self): 9 | pass 10 | 11 | def deposit(self, amount): 12 | pass 13 | 14 | def withdraw(self, amount): 15 | pass 16 | 17 | def close(self): 18 | pass 19 | -------------------------------------------------------------------------------- /exercises/practice/clock/clock.py: -------------------------------------------------------------------------------- 1 | class Clock: 2 | def __init__(self, hour, minute): 3 | pass 4 | 5 | def __repr__(self): 6 | pass 7 | 8 | def __str__(self): 9 | pass 10 | 11 | def __eq__(self, other): 12 | pass 13 | 14 | def __add__(self, minutes): 15 | pass 16 | 17 | def __sub__(self, minutes): 18 | pass 19 | -------------------------------------------------------------------------------- /exercises/practice/pascals-triangle/.meta/example.py: -------------------------------------------------------------------------------- 1 | def rows(row_count, previous_row=[1]): 2 | if row_count < 0: 3 | raise ValueError("number of rows is negative") 4 | elif row_count == 0: 5 | return [] 6 | temp_row = previous_row + [0] 7 | new_row = list(map(sum, zip(temp_row, temp_row[::-1]))) 8 | return [previous_row] + rows(row_count - 1, new_row) 9 | -------------------------------------------------------------------------------- /exercises/practice/react/react.py: -------------------------------------------------------------------------------- 1 | class InputCell: 2 | def __init__(self, initial_value): 3 | self.value = None 4 | 5 | 6 | class ComputeCell: 7 | def __init__(self, inputs, compute_function): 8 | self.value = None 9 | 10 | def add_callback(self, callback): 11 | pass 12 | 13 | def remove_callback(self, callback): 14 | pass 15 | -------------------------------------------------------------------------------- /exercises/practice/rna-transcription/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "bc3b17f7-a748-4cb3-b44d-e7049e321bc3", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach for RNA Transcription.", 8 | "authors": ["bobahop"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /reference/concepts/decorators_as_higher_order_functions.md: -------------------------------------------------------------------------------- 1 | # Decorators as higher-order functions 2 | 3 | TODO: ADD MORE 4 | 5 | - a function that takes one or more other functions as arguments, _returning_ a function as its return value. The example uses the built-in `property()` as a higher-order function through `@property`. [robot-simulator](../exercise-concepts/robot-simulator.md) 6 | -------------------------------------------------------------------------------- /concepts/loops/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "There are two looping constructs in Python: while loops for indefinite/uncounted iteration, and for loops for definite/counted iteration. The keywords break, continue, and else help customize loop behavior. The range() and enumerate() functions help with loop counting and indexing.", 3 | "authors": ["BethanyG"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/raindrops/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "79248d29-772d-4618-bd7d-49a9bba693fd", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach to the Raindrops exercise.", 8 | "authors": ["BethanyG", "colinleach"] 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "1d5866e9-6c74-411b-ab67-e986d154876e", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach for reversing a string.", 8 | "authors": ["bethanyg", "colinleach"] 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "8ab0e53c-0e9f-4525-a8ad-dea838e17d8c", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the performance between different approaches", 8 | "authors": ["meatball133", "bethanyg"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/word-search/word_search.py: -------------------------------------------------------------------------------- 1 | class Point: 2 | def __init__(self, x, y): 3 | self.x = None 4 | self.y = None 5 | 6 | def __eq__(self, other): 7 | return self.x == other.x and self.y == other.y 8 | 9 | 10 | class WordSearch: 11 | def __init__(self, puzzle): 12 | pass 13 | 14 | def search(self, word): 15 | pass 16 | -------------------------------------------------------------------------------- /reference/concepts/class_composition.md: -------------------------------------------------------------------------------- 1 | # Class composition (vs inheritance) 2 | 3 | TODO: ADD MORE 4 | 5 | - adding functionality from a class by incorporating an instance of that class in a class you are creating. The example creates a `robot` by instantiating a `compass` and assigning it to the `self`.compass attribute of `robot`. [robot-simulator](../exercise-concepts/robot-simulator.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/keywords/if.md: -------------------------------------------------------------------------------- 1 | # `if` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-if-docs], as well as [this blog post][keyword-if-etymology] for more details. 6 | 7 | [keyword-if-docs]: https://docs.python.org/3/reference/compound_stmts.html#the-if-statement 8 | [keyword-if-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#if 9 | -------------------------------------------------------------------------------- /exercises/practice/bob/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Bob is a [lackadaisical][] teenager. 4 | He likes to think that he's very cool. 5 | And he definitely doesn't get excited about things. 6 | That wouldn't be cool. 7 | 8 | When people talk to him, his responses are pretty limited. 9 | 10 | [lackadaisical]: https://www.collinsdictionary.com/dictionary/english/lackadaisical 11 | -------------------------------------------------------------------------------- /exercises/practice/grade-school/.docs/instructions.append.md: -------------------------------------------------------------------------------- 1 | # Instructions append 2 | 3 | The tests for this exercise expect your school roster will be implemented via a School `class` in Python. 4 | If you are unfamiliar with classes in Python, [classes][classes in python] from the Python docs is a good place to start. 5 | 6 | [classes in python]: https://docs.python.org/3/tutorial/classes.html 7 | -------------------------------------------------------------------------------- /exercises/practice/palindrome-products/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "c90d5c22-3133-4f1b-88b6-3ea9b6df298e", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the performance between different approaches", 8 | "authors": ["meatball133", "bethanyg"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/wordy/.approaches/recursion/snippet.txt: -------------------------------------------------------------------------------- 1 | def calculate(equation): 2 | if len(equation) == 1: return int(equation[0]) 3 | else: 4 | try: 5 | x_value, operation, y_value, *rest = equation 6 | equation = [OPERATIONS[operation](int(x_value), int(y_value)), *rest] 7 | except: raise ValueError("syntax error") 8 | return calculate(equation) -------------------------------------------------------------------------------- /exercises/practice/yacht/yacht.py: -------------------------------------------------------------------------------- 1 | # Score categories. 2 | # Change the values as you see fit. 3 | YACHT = None 4 | ONES = None 5 | TWOS = None 6 | THREES = None 7 | FOURS = None 8 | FIVES = None 9 | SIXES = None 10 | FULL_HOUSE = None 11 | FOUR_OF_A_KIND = None 12 | LITTLE_STRAIGHT = None 13 | BIG_STRAIGHT = None 14 | CHOICE = None 15 | 16 | 17 | def score(dice, category): 18 | pass 19 | -------------------------------------------------------------------------------- /reference/concepts/immutability.md: -------------------------------------------------------------------------------- 1 | # Immutability 2 | 3 | TODO: ADD MORE 4 | 5 | - strings are immutable, and so cannot have values assigned; new strings can be created, however [phone-number](../exercise-concepts/phone-number.md) 6 | - `text` str in Python is [immutable](https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str). [reverse-string](../exercise-concepts/reverse-string.md) 7 | -------------------------------------------------------------------------------- /reference/concepts/keywords/or.md: -------------------------------------------------------------------------------- 1 | # `or` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-or-docs], as well as [this blog post][keyword-or-etymology] for more details. 6 | 7 | [keyword-or-docs]: https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not 8 | [keyword-or-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#or 9 | -------------------------------------------------------------------------------- /concepts/generators/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Generators are functions or expressions that return a special type of iterator called a 'generator-iterator'. Generator-iterators are lazy: they do not store their values in memory but generate them when needed.", 3 | "authors": ["J08K"], 4 | "contributors": [ 5 | "BethanyG", 6 | "kytrinyx", 7 | "meatball133" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /exercises/practice/collatz-conjecture/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "f5071a22-f13a-4650-afea-b7aaee8f2b12", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach for collatz conjecture.", 8 | "authors": ["meatball133", "bethanyg"] 9 | } 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /exercises/practice/difference-of-squares/.meta/example.py: -------------------------------------------------------------------------------- 1 | def square_of_sum(number): 2 | sum_ = number * (number + 1) / 2 3 | return sum_ * sum_ 4 | 5 | 6 | def sum_of_squares(number): 7 | numerator = number * (number + 1) * (2 * number + 1) 8 | return numerator / 6 9 | 10 | 11 | def difference_of_squares(number): 12 | return square_of_sum(number) - sum_of_squares(number) 13 | -------------------------------------------------------------------------------- /exercises/practice/isbn-verifier/.meta/example.py: -------------------------------------------------------------------------------- 1 | def is_valid(isbn): 2 | chars = list(isbn.replace('-', '')) 3 | if chars and chars[-1] == 'X': 4 | chars[-1] = '10' 5 | if not len(chars) == 10 or not all(char.isdigit() for char in chars): 6 | return False 7 | indices = list(range(10, 0, -1)) 8 | return sum(int(char) * idx for char, idx in zip(chars, indices)) % 11 == 0 9 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.approaches/bitfield/snippet.txt: -------------------------------------------------------------------------------- 1 | def is_pangram(sentence): 2 | letter_flags = 0 3 | for letter in sentence: 4 | if letter >= 'a' and letter <= 'z': 5 | letter_flags |= 1 << ord(letter) - A_LCASE 6 | elif letter >= 'A' and letter <= 'Z': 7 | letter_flags |= 1 << ord(letter) - A_UCASE 8 | return letter_flags == ALL_26_BITS_SET 9 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/sum.md: -------------------------------------------------------------------------------- 1 | # `sum` 2 | 3 | The `sum` built-in function is a useful concept to solve the [variable-length-quantity][variable-length-quantity] exercise. 4 | 5 | TODO: ADD MORE DETAIL 6 | 7 | See [docs][docs]. 8 | 9 | [docs]: https://docs.python.org/3/library/functions.html#sum 10 | [variable-length-quantity]: ../../exercise-concepts/variable-length-quantity.md 11 | -------------------------------------------------------------------------------- /reference/concepts/keywords/del.md: -------------------------------------------------------------------------------- 1 | # `del` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-del-docs], as well as [this blog post][keyword-del-etymology] for more details. 6 | 7 | [keyword-del-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-del-statement 8 | [keyword-del-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#del 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/for.md: -------------------------------------------------------------------------------- 1 | # `for` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-for-docs], as well as [this blog post][keyword-for-etymology] for more details. 6 | 7 | [keyword-for-docs]: https://docs.python.org/3/reference/compound_stmts.html#the-for-statement 8 | [keyword-for-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#for 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/in.md: -------------------------------------------------------------------------------- 1 | # `in` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-in-docs], as well as [this blog post][keyword-in-etymology] for more details. 6 | 7 | [keyword-in-docs]: https://docs.python.org/3/reference/expressions.html#membership-test-operations 8 | [keyword-in-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#in 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/true.md: -------------------------------------------------------------------------------- 1 | # `true` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-true-docs], as well as [this blog post][keyword-true-etymology] for more details. 6 | 7 | [keyword-true-docs]: https://docs.python.org/3.7/library/stdtypes.html#boolean-values 8 | [keyword-true-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#true 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/try.md: -------------------------------------------------------------------------------- 1 | # `try` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-try-docs], as well as [this blog post][keyword-try-etymology] for more details. 6 | 7 | [keyword-try-docs]: https://docs.python.org/3/reference/compound_stmts.html#the-try-statement 8 | [keyword-try-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#try 9 | -------------------------------------------------------------------------------- /exercises/practice/gigasecond/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to determine the date and time one gigasecond after a certain date. 4 | 5 | A gigasecond is one thousand million seconds. 6 | That is a one with nine zeros after it. 7 | 8 | If you were born on _January 24th, 2015 at 22:00 (10:00:00pm)_, then you would be a gigasecond old on _October 2nd, 2046 at 23:46:40 (11:46:40pm)_. 9 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.approaches/stack-match/snippet.txt: -------------------------------------------------------------------------------- 1 | bracket_map = {"]" : "[", "}": "{", ")":"("} 2 | stack = [] 3 | for element in input_string: 4 | if element in bracket_map.values(): tracking.append(element) 5 | if element in bracket_map: 6 | if not stack or (stack.pop() != bracket_map[element]): 7 | return False 8 | return not stack -------------------------------------------------------------------------------- /exercises/practice/pythagorean-triplet/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "b6ae73d5-6ee9-472d-bb48-d8eac8a097cf", 5 | "slug": "performance", 6 | "title": "Performance", 7 | "blurb": "Results and analysis of timing tests for the various approaches.", 8 | "authors": ["colinleach", 9 | "BethanyG"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /exercises/practice/say/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Given a number, your task is to express it in English words exactly as your friend should say it out loud. 4 | Yaʻqūb expects to use numbers from 0 up to 999,999,999,999. 5 | 6 | Examples: 7 | 8 | - 0 → zero 9 | - 1 → one 10 | - 12 → twelve 11 | - 123 → one hundred twenty-three 12 | - 1,234 → one thousand two hundred thirty-four 13 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.approaches/nested-loops/snippet.txt: -------------------------------------------------------------------------------- 1 | def primes(number): 2 | number += 1 3 | prime = [True for item in range(number)] 4 | for index in range(2, number): 5 | if not prime[index]: continue 6 | for candidate in range(2 * index, number, index): 7 | prime[candidate] = False 8 | return [index for index, value in enumerate(prime) if index > 1 and value] -------------------------------------------------------------------------------- /exercises/practice/word-count/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You teach English as a foreign language to high school students. 4 | 5 | You've decided to base your entire curriculum on TV shows. 6 | You need to analyze which words are used, and how often they're repeated. 7 | 8 | This will let you choose the simplest shows to start with, and to gradually increase the difficulty as time passes. 9 | -------------------------------------------------------------------------------- /reference/concepts/builtin_types/complex.md: -------------------------------------------------------------------------------- 1 | # `complex` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python documentation entries on the [complex number type][docs-complex-type], one of several [numerical types][docs-numerical-types]. 6 | 7 | [docs-complex-type]: https://docs.python.org/3/library/functions.html#complex 8 | [docs-numerical-types]: https://docs.python.org/3/library/stdtypes.html#typesnumeric 9 | -------------------------------------------------------------------------------- /reference/concepts/exception_catching.md: -------------------------------------------------------------------------------- 1 | # Exception catching 2 | 3 | TODO: ADD MORE 4 | 5 | - `Exceptions` can be caught from outside the scope where they are raised, using the `try/except` syntax. All `Exceptions` types inherit from the base class, `Exception` and thus can be caught by either checking specifically for the type of Exception, or for any Exception [hamming](../exercise-concepts/hamming.md) 6 | -------------------------------------------------------------------------------- /reference/concepts/keywords/and.md: -------------------------------------------------------------------------------- 1 | # `and` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-and-docs], as well as [this blog post][keyword-and-etymology] for more details. 6 | 7 | [keyword-and-docs]: https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not 8 | [keyword-and-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#and 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/def.md: -------------------------------------------------------------------------------- 1 | # `def` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-def-docs], as well as [this blog post][keyword-def-etymology] for more details. 6 | 7 | [keyword-def-docs]: https://docs.python.org/3/reference/compound_stmts.html#function-definitions 8 | [keyword-def-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#def 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/false.md: -------------------------------------------------------------------------------- 1 | # `false` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-false-docs], as well as [this blog post][keyword-false-etymology] for more details. 6 | 7 | [keyword-false-docs]: https://docs.python.org/3.7/library/stdtypes.html#boolean-values 8 | [keyword-false-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#false 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/lambda.md: -------------------------------------------------------------------------------- 1 | # `lambda` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-lambda-docs], as well as [this blog post][keyword-lambda-etymology] for more details. 6 | 7 | [keyword-lambda-docs]: https://docs.python.org/3/reference/expressions.html#lambda 8 | [keyword-lambda-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#lambda 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/not.md: -------------------------------------------------------------------------------- 1 | # `not` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-not-docs], as well as [this blog post][keyword-not-etymology] for more details. 6 | 7 | [keyword-not-docs]: https://docs.python.org/3/library/stdtypes.html#boolean-operations-and-or-not 8 | [keyword-not-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#not 9 | -------------------------------------------------------------------------------- /reference/concepts/modular_division.md: -------------------------------------------------------------------------------- 1 | # Modular division 2 | 3 | TODO: ADD MORE 4 | 5 | - the exercise relies on the `%` operator to check if one number is evenly divisible by another [leap](../exercise-concepts/leap.md) 6 | - the example uses the modulus operator to calculate the appropriate _compass_ setting when calling the `right` compass method [robot-simulator](../exercise-concepts/robot-simulator.md) 7 | -------------------------------------------------------------------------------- /exercises/practice/grains/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | There once was a wise servant who saved the life of a prince. 4 | The king promised to pay whatever the servant could dream up. 5 | Knowing that the king loved chess, the servant told the king he would like to have grains of wheat. 6 | One grain on the first square of a chessboard, with the number of grains doubling on each successive square. 7 | -------------------------------------------------------------------------------- /exercises/practice/matching-brackets/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "af7a43b5-c135-4809-9fb8-d84cdd5138d5", 5 | "slug": "performance", 6 | "title": "Performance", 7 | "blurb": "Compare a variety of solutions using benchmarking data.", 8 | "authors": [ 9 | "colinleach", 10 | "BethanyG" 11 | ] 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /exercises/practice/wordy/.approaches/import-callables-from-operator/snippet.txt: -------------------------------------------------------------------------------- 1 | OPERATIONS = {"plus": add, "minus": sub, "multiplied": mul, "divided": div} 2 | while len(equation) > 1: 3 | try: 4 | x_value, operation, y_value, *rest = equation 5 | equation = [OPERATIONS[operation](int(x_value), int(y_value)),*rest] 6 | except: 7 | raise ValueError("syntax error") 8 | return equation[0] -------------------------------------------------------------------------------- /reference/concepts/keywords/await.md: -------------------------------------------------------------------------------- 1 | # `await` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-await-docs], as well as [this blog post][keyword-await-etymology] for more details. 6 | 7 | [keyword-await-docs]: https://docs.python.org/3/reference/expressions.html#await-expression 8 | [keyword-await-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#await 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/with.md: -------------------------------------------------------------------------------- 1 | # `with` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-with-docs], as well as [this blog post][keyword-with-etymology] for more details. 6 | 7 | [keyword-with-docs]: https://docs.python.org/3/reference/compound_stmts.html#the-with-statement 8 | [keyword-with-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#with 9 | -------------------------------------------------------------------------------- /reference/concepts/multiple_assignment.md: -------------------------------------------------------------------------------- 1 | # Multiple assignment 2 | 3 | TODO: ADD MORE 4 | 5 | - Python allows multiple assignment, assigning the items on the left of `=` _in order_ to the values on the right of `=` by forming tuples and then "unpacking" them. This exercise solution uses multiple assignment for the constant values NORTH, EAST, SOUTH, WEST. [robot-simulator](../exercise-concepts/robot-simulator.md) 6 | -------------------------------------------------------------------------------- /concepts/function-arguments/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Python supports positional, keyword, variadic-positional, variadic-keyword, and default function arguments. Argument types can be any valid Python object, including other functions or classes. This allows for a wide range of options when defining and calling functions in a program.", 3 | "authors": ["bobahop", "bethanyg"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/leap/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "e54a0a87-cb9d-4d5c-aa86-93a239ffdd8c", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach for determining a leap year.", 8 | "authors": ["bobahop", 9 | "colinleach"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /exercises/practice/sieve/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "slug": "performance", 5 | "uuid": "fdbee56a-b4db-4776-8aab-3f7788c612aa", 6 | "title": "Performance deep dive", 7 | "authors": [ 8 | "BethanyG", 9 | "colinleach" 10 | ], 11 | "blurb": "Results and analysis of timing tests for the various approaches." 12 | } 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /exercises/practice/yacht/.approaches/functions/snippet.txt: -------------------------------------------------------------------------------- 1 | def digits(num): 2 | return lambda dice: dice.count(num) * num 3 | YACHT = lambda x: 50 if x.count(x[0]) == len(x) else 0 4 | ONES = digits(1) 5 | FULL_HOUSE = lambda x: sum(x) if len(set(x)) == 2 and x.count(x[0]) in [2, 3] else 0 6 | LITTLE_STRAIGHT = lambda x: 30 if sorted(x) == [1, 2, 3, 4, 5] else 0 7 | def score(dice, category): 8 | return category(dice) -------------------------------------------------------------------------------- /reference/concepts/instantiation.md: -------------------------------------------------------------------------------- 1 | # Instantiation 2 | 3 | TODO: ADD MORE 4 | 5 | - creating different instances of the `robot` class with different data representing different starting positions and bearing are tested. [robot-simulator](../exercise-concepts/robot-simulator.md) 6 | - creating different instances with different data representing different `matrices` is tested [matrix](../exercise-concepts/matrix.md) 7 | -------------------------------------------------------------------------------- /reference/concepts/keywords/break.md: -------------------------------------------------------------------------------- 1 | # `break` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-break-docs], as well as [this blog post][keyword-break-etymology] for more details. 6 | 7 | [keyword-break-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-break-statement 8 | [keyword-break-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#break 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/class.md: -------------------------------------------------------------------------------- 1 | # `class` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-class-docs], as well as [this blog post][keyword-class-etymology] for more details. 6 | 7 | [keyword-class-docs]: https://docs.python.org/3/reference/compound_stmts.html#class-definitions 8 | [keyword-class-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#class 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/pass.md: -------------------------------------------------------------------------------- 1 | # `pass` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-pass-docs], as well as [this blog post][keyword-pass-etymology] for more details. 6 | 7 | [keyword-pass-docs]: https://docs.python.org/3/tutorial/controlflow.html?highlight=pass#pass-statements 8 | [keyword-pass-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#pass 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/raise.md: -------------------------------------------------------------------------------- 1 | # `raise` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-raise-docs], as well as [this blog post][keyword-raise-etymology] for more details. 6 | 7 | [keyword-raise-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-raise-statement 8 | [keyword-raise-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#raise 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/while.md: -------------------------------------------------------------------------------- 1 | # `while` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-while-docs], as well as [this blog post][keyword-while-etymology] for more details. 6 | 7 | [keyword-while-docs]: https://docs.python.org/3/reference/compound_stmts.html#the-while-statement 8 | [keyword-while-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#while 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/yield.md: -------------------------------------------------------------------------------- 1 | # `yield` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-yield-docs], as well as [this blog post][keyword-yield-etymology] for more details. 6 | 7 | [keyword-yield-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-yield-statement 8 | [keyword-yield-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#yield 9 | -------------------------------------------------------------------------------- /concepts/sets/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "A set is a mutable & unordered collection of hashable objects. Members must be unique, and sets are often used to quickly dedupe groups of items. They can be iterated over via \"for item in \" or \"for index, item in enumerate()\", but do not support sequence-type behaviors like indexing, slicing, or sorting.", 3 | "authors": ["bethanyg"], 4 | "contributors": [] 5 | } -------------------------------------------------------------------------------- /exercises/practice/grains/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Calculate the number of grains of wheat on a chessboard. 4 | 5 | A chessboard has 64 squares. 6 | Square 1 has one grain, square 2 has two grains, square 3 has four grains, and so on, doubling each time. 7 | 8 | Write code that calculates: 9 | 10 | - the number of grains on a given square 11 | - the total number of grains on the chessboard 12 | -------------------------------------------------------------------------------- /exercises/practice/high-scores/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Manage a game player's High Score list. 4 | 5 | Your task is to build a high-score component of the classic Frogger game, one of the highest selling and most addictive games of all time, and a classic of the arcade era. 6 | Your task is to write methods that return the highest score from the list, the last added score and the three highest scores. 7 | -------------------------------------------------------------------------------- /exercises/practice/octal/.meta/example.py: -------------------------------------------------------------------------------- 1 | def parse_octal(digits): 2 | digits = _validate_octal(digits) 3 | return sum(int(digit) * 8 ** idx 4 | for (idx, digit) in enumerate(reversed(digits))) 5 | 6 | 7 | def _validate_octal(digits): 8 | for digit in digits: 9 | if not '0' <= digit < '8': 10 | raise ValueError("Invalid octal digit: " + digit) 11 | return digits 12 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.articles/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "articles": [ 3 | { 4 | "uuid": "f832ad8a-09dc-4929-9e46-d3e7c286a063", 5 | "slug": "performance", 6 | "title": "Performance deep dive", 7 | "blurb": "Deep dive to find out the most performant approach to determining a pangram.", 8 | "authors": ["bobahop"], 9 | "contributors": ["princemuel"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /reference/concepts/builtin_functions/enumerate.md: -------------------------------------------------------------------------------- 1 | # `enumerate` 2 | 3 | The `enumerate` built-in function is a useful concept in the [variable-length-quantity][variable-length-quantity] exercise. 4 | 5 | TODO: ADD MORE DETAIL 6 | 7 | See [docs][docs]. 8 | 9 | [docs]: https://docs.python.org/3/library/functions.html#enumerate 10 | [variable-length-quantity]: ../../exercise-concepts/variable-length-quantity.md 11 | -------------------------------------------------------------------------------- /reference/concepts/builtin_types/type.md: -------------------------------------------------------------------------------- 1 | # `type` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | Both the root [metaclass of all builtin objects][docs-type-as-metaclass] and a [function that returns the type of a given object][docs-type-as-function]. 6 | 7 | [docs-type-as-function]: https://docs.python.org/3/library/functions.html#type 8 | [docs-type-as-metaclass]: https://docs.python.org/3/library/stdtypes.html#bltin-type-objects 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/assert.md: -------------------------------------------------------------------------------- 1 | # `assert` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-assert-docs], as well as [this blog post][keyword-assert-etymology] for more details. 6 | 7 | [keyword-assert-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-assert-statement 8 | [keyword-assert-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#assert 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/global.md: -------------------------------------------------------------------------------- 1 | # `global` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-global-docs], as well as [this blog post][keyword-global-etymology] for more details. 6 | 7 | [keyword-global-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-global-statement 8 | [keyword-global-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#global 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/import.md: -------------------------------------------------------------------------------- 1 | # `import` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-import-docs], as well as [this blog post][keyword-import-etymology] for more details. 6 | 7 | [keyword-import-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-import-statement 8 | [keyword-import-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#import 9 | -------------------------------------------------------------------------------- /reference/concepts/keywords/return.md: -------------------------------------------------------------------------------- 1 | # `return` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-return-docs], as well as [this blog post][keyword-return-etymology] for more details. 6 | 7 | [keyword-return-docs]: https://docs.python.org/3/reference/simple_stmts.html#the-return-statement 8 | [keyword-return-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#return 9 | -------------------------------------------------------------------------------- /concepts/basics/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Python is a dynamic and strongly typed programming language in which variables can be bound and re-bound to any data type. It employs both duck typing and gradual typing (via type hints). Python uses significant indentation to denote code blocks and puts strong emphasis on code readability.", 3 | "authors": ["BethanyG"], 4 | "contributors": ["cmccandless", "PaulT89"] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/grep/.meta/plugins.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | RGX_ILLEGAL_CHARS = re.compile(r"\||-") 4 | RGX_LINEBREAK = re.compile(r"\s*\n\s*") 5 | 6 | 7 | def strip_illegal(s): 8 | return RGX_ILLEGAL_CHARS.sub("", s) 9 | 10 | 11 | def clean_filetext(text): 12 | text = strip_illegal(text) 13 | text = RGX_ILLEGAL_CHARS.sub("", text) 14 | text = RGX_LINEBREAK.sub("\n", text) 15 | return text.strip() 16 | -------------------------------------------------------------------------------- /exercises/practice/largest-series-product/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | You work for a government agency that has intercepted a series of encrypted communication signals from a group of bank robbers. 4 | The signals contain a long sequence of digits. 5 | Your team needs to use various digital signal processing techniques to analyze the signals and identify any patterns that may indicate the planning of a heist. 6 | -------------------------------------------------------------------------------- /exercises/practice/meetup/meetup.py: -------------------------------------------------------------------------------- 1 | # subclassing the built-in ValueError to create MeetupDayException 2 | class MeetupDayException(ValueError): 3 | """Exception raised when the Meetup weekday and count do not result in a valid date. 4 | 5 | message: explanation of the error. 6 | 7 | """ 8 | def __init__(self): 9 | pass 10 | 11 | 12 | def meetup(year, month, week, day_of_week): 13 | pass 14 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.approaches/if-else/snippet.txt: -------------------------------------------------------------------------------- 1 | def translate_digit(digit: int, translations: iter) -> str: 2 | units, four, five, nine = translations 3 | if digit < 4: return digit * units 4 | if digit == 4: return four 5 | if digit < 9: return five + (digit - 5) * units 6 | return nine 7 | 8 | if c > 0: res += translate_digit(c, ('C', 'CD', 'D', 'CM')) 9 | -------------------------------------------------------------------------------- /exercises/practice/saddle-points/.meta/additional_tests.json: -------------------------------------------------------------------------------- 1 | { 2 | "cases": [ 3 | { 4 | "description": "irregular Matrix", 5 | "property": "saddlePoints", 6 | "input": { 7 | "matrix": [ 8 | [3, 2, 1], 9 | [0, 1], 10 | [2, 1, 0] 11 | ] 12 | }, 13 | "expected": { 14 | "error": "irregular matrix" 15 | } 16 | } 17 | ] 18 | } 19 | -------------------------------------------------------------------------------- /reference/concepts/keywords/async.md: -------------------------------------------------------------------------------- 1 | # `async` 2 | 3 | TODO: ADD MORE DETAIL 4 | 5 | See the Python [documentation entry][keyword-async-docs], as well as [this blog post][keyword-async-etymology] for more details. 6 | 7 | [keyword-async-docs]: https://docs.python.org/3/reference/compound_stmts.html#coroutine-function-definition 8 | [keyword-async-etymology]: https://yawpitchroll.com/posts/the-35-words-you-need-to-python/#async 9 | -------------------------------------------------------------------------------- /concepts/classes/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "Classes are used to create 'instances' (copies) of bundled data and behavior, commonly known as objects. Class instances are integral to Object Oriented Programming (OOP), in which programs are made up of objects that interact with one another, keep state, and act upon data.", 3 | "authors": ["bethanyg", "DjangoFett", "PaulT89"], 4 | "contributors": ["IsaacG"] 5 | } 6 | 7 | 8 | -------------------------------------------------------------------------------- /concepts/enums/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "An enum is a set of unique names that are bound to unique, *constant* values and thereafter are immutable. Enums are defined by inheriting an \"Enum\" class. Built-in enum types are available in the module \"enum\" and the class \"Enum\" can be imported using \"from enum import Enum\" syntax.", 3 | "authors": ["mohanrajanr", "BethanyG"], 4 | "contributors": ["valentin-p"] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/practice/grains/.meta/example.py: -------------------------------------------------------------------------------- 1 | def square(number): 2 | if number == 0: 3 | raise ValueError('square must be between 1 and 64') 4 | elif number < 0: 5 | raise ValueError('square must be between 1 and 64') 6 | elif number > 64: 7 | raise ValueError('square must be between 1 and 64') 8 | 9 | return 2 ** (number - 1) 10 | 11 | 12 | def total(): 13 | return (2 ** 64) - 1 14 | -------------------------------------------------------------------------------- /exercises/practice/pangram/.docs/instructions.md: -------------------------------------------------------------------------------- 1 | # Instructions 2 | 3 | Your task is to figure out if a sentence is a pangram. 4 | 5 | A pangram is a sentence using every letter of the alphabet at least once. 6 | It is case insensitive, so it doesn't matter if a letter is lower-case (e.g. `k`) or upper-case (e.g. `K`). 7 | 8 | For this exercise, a sentence is a pangram if it contains each of the 26 letters in the English alphabet. 9 | -------------------------------------------------------------------------------- /exercises/practice/pig-latin/.approaches/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "introduction": { 3 | "authors": ["bobahop"], 4 | "contributors": [] 5 | }, 6 | "approaches": [ 7 | { 8 | "uuid": "505e545c-d56c-45e3-8cc6-df3fdb54cc0c", 9 | "slug": "sets-and-slices", 10 | "title": "Sets and slices", 11 | "blurb": "Use sets with slices for parsing.", 12 | "authors": ["bobahop"] 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /exercises/practice/roman-numerals/.approaches/itertools-starmap/snippet.txt: -------------------------------------------------------------------------------- 1 | from itertools import starmap 2 | 3 | def roman(number: int) -> str: 4 | orders = [(1000, "M "), (100, "CDM"), (10, "XLC"), (1, "IVX")] 5 | options = lambda I, V, X: ["", I, I * 2, I * 3, I + V, V, V + I, V + I * 2, V + I * 3, I + X] 6 | compute = lambda n, chars: options(*chars)[number % (n * 10) // n] 7 | return "".join(starmap(compute, orders)) 8 | -------------------------------------------------------------------------------- /exercises/practice/rotational-cipher/.approaches/recursion/snippet.txt: -------------------------------------------------------------------------------- 1 | first_letter, rest = text[0], text[1:] 2 | if first_letter.isalpha(): 3 | if first_letter.isupper(): 4 | return AlPHABET[(AlPHABET.index(first_letter.lower()) + key) % 26].upper() + rotate(rest, key) 5 | else: 6 | return AlPHABET[(AlPHABET.index(first_letter) + key) % 26] + rotate(rest, key) 7 | else: 8 | return first_letter + rotate(rest, key) -------------------------------------------------------------------------------- /reference/concepts/comprehension_syntax.md: -------------------------------------------------------------------------------- 1 | # Comprehension syntax 2 | 3 | TODO: ADD MORE 4 | 5 | - knowing that this is equivalent to a `for loop` - putting the row or column creation code _inside_ the list literal instead of using loop + append. [matrix](../exercise-concepts/matrix.md) 6 | - the use of list comprehension concept can be useful in this exercise [variable-length-quantity](../exercise-concepts/variable-length-quantity.md) 7 | -------------------------------------------------------------------------------- /reference/concepts/constructor.md: -------------------------------------------------------------------------------- 1 | # Constructor 2 | 3 | TODO: ADD MORE 4 | 5 | - student needs to know how to build an object using its constructor [binary-search-tree](../exercise-concepts/binary-search-tree.md) 6 | - customizing object initialization with actions and persisting data. The example uses a constructor to process the passed in data into a list of lists assigned to an instance property [matrix](../exercise-concepts/matrix.md) 7 | -------------------------------------------------------------------------------- /concepts/tuples/.meta/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "blurb": "A tuple is an immutable collection of items in sequence. Like most collections, tuples can hold any/multiple data type(s) -- including other tuples. Tuples support all common sequence operations, and items are referenced by 0-based index number. Tuples can be iterated over in a loop by using the \"for item in \" syntax.", 3 | "authors": ["BethanyG"], 4 | "contributors": [] 5 | } 6 | -------------------------------------------------------------------------------- /exercises/concept/currency-exchange/.meta/design.md: -------------------------------------------------------------------------------- 1 | # Design 2 | 3 | ## Goal 4 | 5 | The goal of this exercise is to teach the student how to use arithmetic operators and type casting between `int` and `float` in Python 6 | 7 | ## Learning objectives 8 | 9 | - use `+`, `-`, `*`, `/` to add, subtract, multiply, divide numbers(`int` and `float`). 10 | - use `int()` to cast `float` to `int`. 11 | - use `%` to calculate remainders. 12 | -------------------------------------------------------------------------------- /exercises/practice/connect/.meta/template.j2: -------------------------------------------------------------------------------- 1 | {%- extends "master_template.j2" -%} 2 | {% set imports = ["ConnectGame"] %} 3 | 4 | {% macro test_case(case) -%} 5 | def test_{{ case["description"] | to_snake }}(self): 6 | game = ConnectGame("""{{ case["input"]["board"] | join("\n ") }}""") 7 | winner = game.get_winner() 8 | self.assertEqual(winner, "{{ case["expected"] }}") 9 | 10 | {%- endmacro %} -------------------------------------------------------------------------------- /exercises/practice/reverse-string/.docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming. 4 | 5 | For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance. 6 | --------------------------------------------------------------------------------