Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
46ac9ba
[Sync Iteration] python/hello-world/1
exercism-solutions-syncer[bot] Aug 6, 2025
d33d5f1
[Sync Iteration] cpp/hello-world/1
exercism-solutions-syncer[bot] Aug 6, 2025
c078eb7
[Sync Iteration] cpp/leap/1
exercism-solutions-syncer[bot] Aug 6, 2025
e3c2b42
[Sync Iteration] cpp/leap/2
exercism-solutions-syncer[bot] Aug 6, 2025
9577dfa
[Sync Iteration] cpp/leap/3
exercism-solutions-syncer[bot] Aug 6, 2025
0584e79
[Sync Iteration] cpp/leap/4
exercism-solutions-syncer[bot] Aug 6, 2025
657297d
[Sync Iteration] cpp/leap/5
exercism-solutions-syncer[bot] Aug 6, 2025
e665319
[Sync Iteration] cpp/leap/6
exercism-solutions-syncer[bot] Aug 6, 2025
f44c1cf
[Sync Iteration] cpp/leap/7
exercism-solutions-syncer[bot] Aug 6, 2025
12ce7d4
[Sync Iteration] python/guidos-gorgeous-lasagna/1
exercism-solutions-syncer[bot] Aug 6, 2025
48f375a
[Sync Iteration] python/currency-exchange/1
exercism-solutions-syncer[bot] Aug 6, 2025
314325e
[Sync Iteration] python/ghost-gobble-arcade-game/1
exercism-solutions-syncer[bot] Aug 6, 2025
3dbd1c1
[Sync Iteration] python/grains/1
exercism-solutions-syncer[bot] Aug 7, 2025
36761b1
[Sync Iteration] python/armstrong-numbers/1
exercism-solutions-syncer[bot] Aug 7, 2025
2c28223
[Sync Iteration] python/collatz-conjecture/1
exercism-solutions-syncer[bot] Aug 7, 2025
88a4462
[Sync Iteration] python/collatz-conjecture/2
exercism-solutions-syncer[bot] Aug 7, 2025
a51287b
[Sync Iteration] python/armstrong-numbers/2
exercism-solutions-syncer[bot] Aug 7, 2025
b831901
[Sync Iteration] python/grains/2
exercism-solutions-syncer[bot] Aug 7, 2025
a39a642
[Sync Iteration] python/meltdown-mitigation/1
exercism-solutions-syncer[bot] Aug 7, 2025
e707151
[Sync Iteration] python/black-jack/1
exercism-solutions-syncer[bot] Aug 7, 2025
f083d45
[Sync Iteration] python/little-sisters-vocab/1
exercism-solutions-syncer[bot] Aug 7, 2025
7a6f4da
Card Games
ikostan Aug 7, 2025
8c5ba97
Update lists.py
ikostan Aug 7, 2025
fdb5924
Update lists.py
ikostan Aug 7, 2025
47da3ab
Chaitana's Colossal Coaster
ikostan Aug 12, 2025
52e2c57
[Sync Iteration] python/making-the-grade/1
exercism-solutions-syncer[bot] Aug 12, 2025
c40ce55
[Sync Iteration] python/making-the-grade/2
exercism-solutions-syncer[bot] Aug 12, 2025
ace8baa
Making the Grade
ikostan Aug 12, 2025
0c35986
[Sync Iteration] python/square-root/1
exercism-solutions-syncer[bot] Aug 12, 2025
5b7164d
Square Root
ikostan Aug 12, 2025
405a6aa
[Sync Iteration] javascript/hello-world/1
exercism-solutions-syncer[bot] Aug 12, 2025
17b8872
[Sync Iteration] python/leap/1
exercism-solutions-syncer[bot] Aug 12, 2025
457f15f
[Sync Iteration] python/leap/2
exercism-solutions-syncer[bot] Aug 12, 2025
fcdb1b9
Leap
ikostan Aug 12, 2025
e06201a
Merge pull request #24 from ikostan/main
ikostan Aug 13, 2025
779bd5d
Merge pull request #1 from ikostan/exercism-sync/387ed6167408d72c
ikostan Aug 13, 2025
8cc4407
Merge pull request #25 from ikostan/main
ikostan Aug 13, 2025
ed5bbca
Merge pull request #2 from ikostan/exercism-sync/bf33b1d15dbee197
ikostan Aug 13, 2025
e2224a9
Merge pull request #26 from ikostan/main
ikostan Aug 13, 2025
b6f4447
Merge pull request #4 from ikostan/exercism-sync/94d70b586a9ab0bb
ikostan Aug 13, 2025
406403c
Merge pull request #27 from ikostan/main
ikostan Aug 13, 2025
0bed46b
Merge pull request #19 from ikostan/exercism-sync/717990789c686488
ikostan Aug 13, 2025
1d54aa5
Merge pull request #28 from ikostan/main
ikostan Aug 13, 2025
dbbaf36
Merge pull request #3 from ikostan/exercism-sync/28bc45d0c984dbf1
ikostan Aug 13, 2025
2a2d60a
Update exchange.py
ikostan Aug 13, 2025
7e9b879
Merge pull request #29 from ikostan/main
ikostan Aug 13, 2025
5f97815
Merge pull request #5 from ikostan/exercism-sync/e234407874af52b6
ikostan Aug 13, 2025
f19a303
Merge pull request #30 from ikostan/main
ikostan Aug 13, 2025
f9fa358
Merge pull request #6 from ikostan/exercism-sync/89a3588db382e990
ikostan Aug 13, 2025
c9346e0
Merge pull request #31 from ikostan/main
ikostan Aug 13, 2025
d86459d
Create pylint.yml
ikostan Aug 13, 2025
7fb88fd
Update pylint.yml
ikostan Aug 13, 2025
c5a9f4c
LINTING FIXES
ikostan Aug 13, 2025
23f6c6c
Update pylint.yml
ikostan Aug 13, 2025
df47e9e
Docstring added
ikostan Aug 13, 2025
8632e0e
Docstrings added
ikostan Aug 13, 2025
45e219a
Docstrings added
ikostan Aug 13, 2025
9aa621c
Update lasagna_test.py
ikostan Aug 13, 2025
f7ab7cd
Update README.md
ikostan Aug 13, 2025
4446b5d
Update pylint.yml
ikostan Aug 26, 2025
7136c78
# pylint: disable=C0116
ikostan Aug 26, 2025
9e5d829
# pylint: disable=C0116
ikostan Aug 26, 2025
409aae5
Update arcade_game_test.py
ikostan Aug 26, 2025
e491b56
Update hello_world.py
ikostan Aug 26, 2025
4161efa
Update .pylintrc
ikostan Aug 26, 2025
1341cb0
Update .pylintrc
ikostan Aug 26, 2025
d8b9a71
Update .pylintrc
ikostan Aug 26, 2025
3f23501
Update conditionals.py
ikostan Aug 26, 2025
20287ea
[Sync Iteration] python/meltdown-mitigation/2
exercism-solutions-syncer[bot] Aug 26, 2025
f30d1ee
Create config.json
ikostan Aug 26, 2025
6b476bf
Update conditionals.py
ikostan Aug 26, 2025
f40cb84
[Sync Iteration] python/triangle/1
exercism-solutions-syncer[bot] Aug 26, 2025
bd80626
Create pytest.yml
ikostan Aug 26, 2025
b968478
Update pytest.yml
ikostan Aug 26, 2025
564ba7d
Update pylint.yml
ikostan Aug 26, 2025
d6d6bbe
Triangle
ikostan Aug 26, 2025
f56652b
[Sync Iteration] python/triangle/2
exercism-solutions-syncer[bot] Aug 26, 2025
6256a73
Update triangle_test.py
ikostan Aug 26, 2025
1f1bc6a
Update triangle.py
ikostan Aug 26, 2025
c76b668
Update triangle.py
ikostan Aug 26, 2025
c932f46
[Sync Iteration] python/triangle/3
exercism-solutions-syncer[bot] Aug 26, 2025
86f9ddd
Update triangle_test.py
ikostan Aug 26, 2025
7d38511
Merge pull request #7 from ikostan/exercism-sync/15089c1344a3d543
ikostan Aug 26, 2025
b84570c
Update README.md
ikostan Aug 26, 2025
a557f22
Merge pull request #36 from ikostan/main
ikostan Aug 26, 2025
279dfde
Merge pull request #35 from ikostan/exercism-sync/f7ebd665f8757e1e
ikostan Aug 26, 2025
a4d3582
Merge pull request #37 from ikostan/main
ikostan Aug 26, 2025
e979072
Merge pull request #34 from ikostan/exercism-sync/a5f63c45875196e6
ikostan Aug 26, 2025
d08c23f
Merge pull request #38 from ikostan/main
ikostan Aug 26, 2025
76a1cf0
Merge pull request #33 from ikostan/exercism-sync/2d8e06b48072e81b
ikostan Aug 26, 2025
6394578
Merge pull request #39 from ikostan/main
ikostan Aug 26, 2025
30edef6
Merge pull request #32 from ikostan/exercism-sync/8c7a2ebc7daa8b8c
ikostan Aug 26, 2025
f423e76
Merge pull request #40 from ikostan/main
ikostan Aug 26, 2025
bdb8d0d
Merge pull request #23 from ikostan/exercism-sync/9f396a54fb474c81
ikostan Aug 26, 2025
81f62f4
Merge pull request #41 from ikostan/main
ikostan Aug 26, 2025
8b3679c
Ruff
ikostan Aug 26, 2025
a77d891
Update pyproject.toml
ikostan Aug 26, 2025
60880d2
Update pyproject.toml
ikostan Aug 26, 2025
a026afd
Ruff format changes
ikostan Aug 26, 2025
edebb64
Update ruff.yml
ikostan Aug 26, 2025
3496746
Merge pull request #22 from ikostan/exercism-sync/68fed7ece9ef9101
ikostan Aug 26, 2025
96abc0f
Merge pull request #42 from ikostan/main
ikostan Aug 26, 2025
99ba2bc
Update README.md
ikostan Aug 26, 2025
efb1525
Merge pull request #21 from ikostan/exercism-sync/8f935deb6edad6df
ikostan Aug 26, 2025
b1b2abd
Merge pull request #43 from ikostan/main
ikostan Aug 26, 2025
73fa617
Merge pull request #8 from ikostan/exercism-sync/133a2089463277a5
ikostan Aug 26, 2025
435c28b
Merge pull request #44 from ikostan/main
ikostan Aug 28, 2025
934bbf7
Merge pull request #9 from ikostan/exercism-sync/ea674f28537ea928
ikostan Aug 30, 2025
063f242
Merge pull request #45 from ikostan/main
ikostan Aug 30, 2025
83f53a6
Merge pull request #20 from ikostan/exercism-sync/de62ec2127608a08
ikostan Aug 30, 2025
c782174
Merge pull request #46 from ikostan/main
ikostan Aug 30, 2025
1be5d5d
Merge pull request #10 from ikostan/exercism-sync/77d49cffb768676b
ikostan Aug 30, 2025
25bea3e
Merge pull request #47 from ikostan/main
ikostan Aug 30, 2025
e63bd9f
Merge pull request #18 from ikostan/exercism-sync/86ab2f2bd3406432
ikostan Aug 30, 2025
84b2d7b
Merge pull request #48 from ikostan/main
ikostan Aug 30, 2025
6c24cd3
Merge pull request #11 from ikostan/exercism-sync/a941cb94516660fd
ikostan Aug 30, 2025
46267b1
Merge pull request #49 from ikostan/main
ikostan Aug 30, 2025
3c3df58
Merge pull request #12 from ikostan/exercism-sync/371273cb0fddba93
ikostan Aug 30, 2025
2ba4223
Merge pull request #50 from ikostan/main
ikostan Aug 30, 2025
c7ab848
Merge pull request #13 from ikostan/exercism-sync/ced40755b2f3e38d
ikostan Aug 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pylint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
pip install -r requirements.txt
- name: Analysing the code with pylint
run: |
python -m pylint --verbose $(find . -name "*.py" ! -path "*/.venv/*" ! -path "*/venv/*") --rcfile=.pylintrc
29 changes: 29 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Pytest Workflow

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest

- name: Run pytest
run: pytest --verbose --ignore=solutions
25 changes: 25 additions & 0 deletions .github/workflows/ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Ruff Lint and Format

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Ruff lint
run: ruff check --output-format=github .
- name: Run Ruff format check
run: ruff format --check .
3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[MASTER]
ignore=.venv
ignore-paths=^(.*/|)solutions/.*$
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Exercism Python Track
# [Exercism Python Track](https://exercism.io/my/tracks/python)

Learn and master concepts to achieve fluency in Python.
[![Pytest Workflow](https://github.com/ikostan/python/actions/workflows/pytest.yml/badge.svg)](https://github.com/ikostan/python/actions/workflows/pytest.yml)
[![Pylint](https://github.com/ikostan/python/actions/workflows/pylint.yml/badge.svg)](https://github.com/ikostan/python/actions/workflows/pylint.yml)
[![Ruff Lint and Format](https://github.com/ikostan/python/actions/workflows/ruff.yml/badge.svg)](https://github.com/ikostan/python/actions/workflows/ruff.yml)

<div align="center">
<img width="9%" height="9%" src="https://github.com/ikostan/Exercism_Python_Track/blob/master/img/python-track.png" hspace="20">
</div>

## Exercism exercises in Python

### About Exercism
Exercism is an online platform designed to help you improve your coding skills through practice and mentorship.

Exercism provides you with thousands of exercises spread across numerous language tracks. Once you start a language track you are presented with a core set of exercises to complete. Each one is a fun and interesting challenge designed to teach you a little more about the features of a language.

You complete a challenge by downloading the exercise to your computer and solving it in your normal working environment. Once you've finished you submit it online and one of our mentors will give you feedback on how you could improve it using features of the language that you may not be familiar with. After a couple of rounds of refactoring, your exercise will be complete and you will unlock both the next core exercise and also a series of related side-exercises for you to practice with.

Exercism is entirely open source and relies on the contributions of thousands of wonderful people.

Exercism is designed to be fun and friendly, and we place a strong emphasis on empathetic communication.

Sign up and have fun. Exercism is 100% free :)

143 coding exercises for Python on Exercism. From Error Handling to ISBN Verifier.
102 changes: 102 additions & 0 deletions armstrong-numbers/armstrong_numbers_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# pylint: disable=C0301
"""
Armstrong Numbers Test Suite Documentation

## Overview

This test suite validates the `is_armstrong_number` function,
ensuring its correct behavior for various types of numbers:

- Single-digit and multi-digit numbers
- Known Armstrong numbers and non-Armstrong numbers

Tests are auto-generated based on canonical data from
[Exercism problem specifications](https://github.com/exercism/problem-specifications/tree/main/exercises/armstrong-numbers/canonical-data.json).

## Structure

- **Framework:** Uses Python's built-in `unittest`.
- **Target Function:** `is_armstrong_number` (imported from `armstrong_numbers` module).

## Test Cases

| Test Description | Input | Expected Output |
|---------------------------------------------------------|----------|-----------------|
| Zero is an Armstrong number | 0 | `True` |
| Single-digit numbers are Armstrong numbers | 5 | `True` |
| No two-digit numbers (e.g. 10) are Armstrong numbers | 10 | `False` |
| 153 is an Armstrong number | 153 | `True` |
| 100 is not an Armstrong number | 100 | `False` |
| 9474 is an Armstrong number | 9474 | `True` |
| 9475 is not an Armstrong number | 9475 | `False` |
| 9926315 is an Armstrong number | 9926315 | `True` |
| 9926314 is not an Armstrong number | 9926314 | `False` |

## Usage

To run the tests, ensure `is_armstrong_number` is implemented and run:

```bash
python -m unittest armstrong_numbers_test.py

"""

# These tests are auto-generated with test data from:
# https://github.com/exercism/problem-specifications/tree/main/exercises/armstrong-numbers/canonical-data.json
# File last updated on 2023-07-20
Expand All @@ -10,29 +53,88 @@


class ArmstrongNumbersTest(unittest.TestCase):
"""Armstrong Numbers Test."""

def test_zero_is_an_armstrong_number(self):
"""
Test that zero is correctly identified as an Armstrong number.

This test verifies that the function correctly determines that 0
is an Armstrong number, as 0^1 == 0.

:returns: None
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(0), True)

def test_single_digit_numbers_are_armstrong_numbers(self):
"""
Test that all single digit numbers are Armstrong numbers.

:returns: None. Asserts that a single digit number (e.g., 5) is an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(5), True)

def test_there_are_no_two_digit_armstrong_numbers(self):
"""
Test that no two-digit numbers are Armstrong numbers.

:returns: None. Asserts that a two-digit number (e.g., 10) is not an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(10), False)

def test_three_digit_number_that_is_an_armstrong_number(self):
"""
Test that 153 is correctly identified as an Armstrong number.

:returns: None. Asserts that 153 is an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(153), True)

def test_three_digit_number_that_is_not_an_armstrong_number(self):
"""
Test that 100 is not identified as an Armstrong number.

:returns: None. Asserts that 100 is not an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(100), False)

def test_four_digit_number_that_is_an_armstrong_number(self):
"""
Test that 9474 is correctly identified as an Armstrong number.

:returns: None. Asserts that 9474 is an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(9474), True)

def test_four_digit_number_that_is_not_an_armstrong_number(self):
"""
Test that 9475 is not identified as an Armstrong number.

:returns: None. Asserts that 9475 is not an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(9475), False)

def test_seven_digit_number_that_is_an_armstrong_number(self):
"""
Test that 9926315 is correctly identified as an Armstrong number.

:returns: None. Asserts that 9926315 is an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(9926315), True)

def test_seven_digit_number_that_is_not_an_armstrong_number(self):
"""
Test that 9926314 is not identified as an Armstrong number.

:returns: None. Asserts that 9926314 is not an Armstrong number.
:rtype: NoneType
"""
self.assertIs(is_armstrong_number(9926314), False)
47 changes: 31 additions & 16 deletions black-jack/black_jack.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ def value_of_card(card) -> int:
2. 'A' (ace card) = 1
3. '2' - '10' = numerical value.
"""
if card in 'JKQ':
if card in "JKQ":
return 10
elif card == 'A':

if card == "A":
return 1

return int(card)
Expand All @@ -29,16 +30,19 @@ def higher_card(card_one, card_two) -> str | tuple[str, str]:
"""
Determine which card has a higher value in the hand.

:param card_one, card_two: str - cards dealt in hand. See below for values.
:return: str or tuple - resulting Tuple contains both cards if they are of equal value.
:param card_one: str - cards dealt in hand. See below for values.
:param card_two: str - cards dealt in hand. See below for values.
:return: str or tuple - resulting Tuple contains both cards if
they are of equal value.

1. 'J', 'Q', or 'K' (otherwise known as "face cards") = 10
2. 'A' (ace card) = 1
3. '2' - '10' = numerical value.
"""
if value_of_card(card_one) == value_of_card(card_two):
return card_one, card_two
elif value_of_card(card_one) > value_of_card(card_two):

if value_of_card(card_one) > value_of_card(card_two):
return card_one

return card_two
Expand All @@ -56,11 +60,14 @@ def value_of_ace(card_one, card_two) -> int:
3. '2' - '10' = numerical value.
"""
total: int = value_of_card(card_one) + value_of_card(card_two)
# Hint: if we already have an ace in hand, then the value for the upcoming ace would be 1.
if card_one == 'A' or card_two == 'A':
# Hint: if we already have an ace in hand, then the value for
# the upcoming ace would be 1.
if card_one == "A" or card_two == "A":
return 1
# The value of the hand with the ace needs to be as high as possible without going over 21.
elif 21 - total >= 11:
# The value of the hand with the ace needs to be as high as
# possible without going over 21.

if 21 - total >= 11:
return 11

return 1
Expand All @@ -70,7 +77,10 @@ def is_blackjack(card_one, card_two) -> bool:
"""
Determine if the hand is a 'natural' or 'blackjack'.

:param card_one, card_two: str - card dealt. See below for values.
:param card_one: card dealt. See below for values.
:type card_one: str
:param card_two: card dealt. See below for values.
:type card_two: str
:return: bool - is the hand is a blackjack (two cards worth 21).

1. 'J', 'Q', or 'K' (otherwise known as "face cards") = 10
Expand All @@ -79,9 +89,10 @@ def is_blackjack(card_one, card_two) -> bool:
"""
# If a player is dealt an ace (A) and a ten-card (10, K, Q, or J)
# as their first two cards, then the player has a score of 21.
if card_one == 'A' and card_two in ('J', 'Q', 'K', '10'):
if card_one == "A" and card_two in ("J", "Q", "K", "10"):
return True
elif card_two == 'A' and card_one in ('J', 'Q', 'K', '10'):

if card_two == "A" and card_one in ("J", "Q", "K", "10"):
return True

return False
Expand All @@ -91,8 +102,10 @@ def can_split_pairs(card_one, card_two) -> bool:
"""
Determine if a player can split their hand into two hands.

:param card_one, card_two: str - cards dealt.
:return: bool - can the hand be split into two pairs? (i.e. cards are of the same value).
:param card_one: str - cards dealt.
:param card_two: str - cards dealt.
:return: bool - can the hand be split into two pairs?
(i.e. cards are of the same value).
"""
if value_of_card(card_one) == value_of_card(card_two):
return True
Expand All @@ -104,7 +117,9 @@ def can_double_down(card_one, card_two) -> bool:
"""
Determine if a blackjack player can place a double down bet.

:param card_one, card_two: str - first and second cards in hand.
:return: bool - can the hand can be doubled down? (i.e. totals 9, 10 or 11 points).
:param card_one: str - first and second cards in hand.
:param card_two: str - first and second cards in hand.
:return: bool - can the hand can be doubled down?
(i.e. totals 9, 10 or 11 points).
"""
return 9 <= value_of_card(card_one) + value_of_card(card_two) <= 11
Loading