Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions fundamentals/can_form_triangle/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Write a function `can_form_triangle(a: int, b: int, c: int) -> bool` that takes three positive integers representing side lengths and returns `True` if they can form a valid triangle.

A triangle is valid if the sum of any two sides is greater than the third side.

**Hint**: You’ll need to check all three combinations of two sides.
34 changes: 34 additions & 0 deletions fundamentals/can_form_triangle/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"input": [3, 4, 5],
"output": true
},
{
"input": [1, 1, 2],
"output": false
},
{
"input": [5, 5, 5],
"output": true
},
{
"input": [10, 1, 1],
"output": false
},
{
"input": [7, 10, 5],
"output": true
},
{
"input": [2, 2, 4],
"output": false
},
{
"input": [100, 50, 49],
"output": false
},
{
"input": [8, 15, 17],
"output": true
}
]
10 changes: 10 additions & 0 deletions fundamentals/can_form_triangle/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Can Form Triangle",
"name": "can_form_triangle",
"difficulty": "easy",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
"coding"
]
}
1 change: 1 addition & 0 deletions fundamentals/can_form_triangle/starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def can_form_triangle(a: int, b: int, c: int) -> bool:
2 changes: 1 addition & 1 deletion fundamentals/decimal-match/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Decimal Match",
"name": "decimal_match",
"difficulty": "easy",
"difficulty": "medium",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
Expand Down
3 changes: 3 additions & 0 deletions fundamentals/difference_21/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write a function `difference_21(n: int) -> int` that returns the absolute difference between `n` and 21.

If `n` is over 21, return double the absolute difference.
34 changes: 34 additions & 0 deletions fundamentals/difference_21/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"input": [19],
"output": 2
},
{
"input": [21],
"output": 0
},
{
"input": [25],
"output": 8
},
{
"input": [0],
"output": 21
},
{
"input": [22],
"output": 2
},
{
"input": [30],
"output": 18
},
{
"input": [20],
"output": 1
},
{
"input": [-5],
"output": 26
}
]
10 changes: 10 additions & 0 deletions fundamentals/difference_21/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Difference 21",
"name": "difference_21",
"difficulty": "medium",
"author": "",
"category": "Fundamentals",
"question_type": [
"coding"
]
}
1 change: 1 addition & 0 deletions fundamentals/difference_21/starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def difference_21(n: int) -> int:
3 changes: 3 additions & 0 deletions fundamentals/difference_is_even/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write a function `difference_is_even(a: int, b: int) -> bool` that takes two integers and returns `True` if the absolute difference between the two numbers is even, and `False` otherwise.

**Hint**: Solve [Is Even](/#/problems/is_even) and [Calculate Absolute](/#/problems/calculate_absolute) first.
30 changes: 30 additions & 0 deletions fundamentals/difference_is_even/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"input": [10, 4],
"output": true
},
{
"input": [7, 2],
"output": false
},
{
"input": [5, 5],
"output": true
},
{
"input": [-3, 1],
"output": false
},
{
"input": [-4, -8],
"output": true
},
{
"input": [-2, 2],
"output": true
},
{
"input": [0, 1],
"output": false
}
]
10 changes: 10 additions & 0 deletions fundamentals/difference_is_even/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Difference Is Even",
"name": "difference_is_even",
"difficulty": "medium",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
"coding"
]
}
1 change: 1 addition & 0 deletions fundamentals/difference_is_even/starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def difference_is_even(a: int, b: int) -> bool:
3 changes: 3 additions & 0 deletions fundamentals/exactly_one_true/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write a function exactly_one_true(a: bool, b: bool, c: bool) -> bool that takes three boolean values and returns `True` if exactly one of them is `True`, and `False` otherwise.

**Hint**: Try counting how many of the inputs are `True`.
34 changes: 34 additions & 0 deletions fundamentals/exactly_one_true/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"input": [true, false, false],
"output": true
},
{
"input": [false, true, false],
"output": true
},
{
"input": [false, false, true],
"output": true
},
{
"input": [true, true, false],
"output": false
},
{
"input": [true, false, true],
"output": false
},
{
"input": [false, true, true],
"output": false
},
{
"input": [true, true, true],
"output": false
},
{
"input": [false, false, false],
"output": false
}
]
10 changes: 10 additions & 0 deletions fundamentals/exactly_one_true/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Exactly One True",
"name": "exactly_one_true",
"difficulty": "easy",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
"coding"
]
}
1 change: 1 addition & 0 deletions fundamentals/exactly_one_true/starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def exactly_one_true(a: bool, b: bool, c: bool) -> bool:
2 changes: 1 addition & 1 deletion fundamentals/extract-decimal/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Extract Decimal",
"name": "extract_decimal",
"difficulty": "easy",
"difficulty": "medium",
"author": "Eric",
"category": "Fundamentals",
"question_type": [
Expand Down
9 changes: 9 additions & 0 deletions fundamentals/grade_from_score/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Write a function grade_from_score(score: int) -> str that takes an integer score between 0 and 100 (inclusive) and returns the corresponding letter grade as a string. Use the following grading scale:

- 90 and above: "A"
- 80–89: "B"
- 70–79: "C"
- 60–69: "D"
- below 60: "F"

**Hint**: Make sure to use if/elif/else statements in the right order!
42 changes: 42 additions & 0 deletions fundamentals/grade_from_score/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"input": [95],
"output": "A"
},
{
"input": [85],
"output": "B"
},
{
"input": [73],
"output": "C"
},
{
"input": [60],
"output": "D"
},
{
"input": [59],
"output": "F"
},
{
"input": [0],
"output": "F"
},
{
"input": [100],
"output": "A"
},
{
"input": [89],
"output": "B"
},
{
"input": [79],
"output": "C"
},
{
"input": [69],
"output": "D"
}
]
10 changes: 10 additions & 0 deletions fundamentals/grade_from_score/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Grade From Score",
"name": "grade_from_score",
"difficulty": "easy",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
"coding"
]
}
1 change: 1 addition & 0 deletions fundamentals/grade_from_score/starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def grade_from_score(score: int) -> str:
2 changes: 1 addition & 1 deletion fundamentals/integer-conversion-loss/meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Integer Conversion Loss",
"name": "integer_conversion_loss",
"difficulty": "easy",
"difficulty": "medium",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
Expand Down
7 changes: 7 additions & 0 deletions fundamentals/is_right_triangle/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Write a function `is_right_triangle(a: int, b: int, c: int) -> bool` that takes three side lengths and returns `True` if they form a right triangle.

A right triangle satisfies the Pythagorean Theorem: the square of the longest side must equal the sum of the squares of the other two sides.

For example:
- `3, 4, 5` forms a right triangle (since 3² + 4² = 5²).
- `5, 12, 13` is also a right triangle.
34 changes: 34 additions & 0 deletions fundamentals/is_right_triangle/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[
{
"input": [3, 4, 5],
"output": true
},
{
"input": [5, 12, 13],
"output": true
},
{
"input": [6, 8, 10],
"output": true
},
{
"input": [1, 1, 1],
"output": false
},
{
"input": [10, 6, 8],
"output": true
},
{
"input": [7, 24, 25],
"output": true
},
{
"input": [9, 10, 15],
"output": false
},
{
"input": [0, 0, 0],
"output": false
}
]
10 changes: 10 additions & 0 deletions fundamentals/is_right_triangle/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "Is Right Triangle",
"name": "is_right_triangle",
"difficulty": "medium",
"author": "ChatGPT",
"category": "Fundamentals",
"question_type": [
"coding"
]
}
1 change: 1 addition & 0 deletions fundamentals/is_right_triangle/starter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
def is_right_triangle(a: int, b: int, c: int) -> bool:
3 changes: 3 additions & 0 deletions fundamentals/minutes_to_seconds/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Write a function `minutes_to_seconds(minutes: int) -> int` that takes a number of minutes and returns the equivalent number of seconds.

There are 60 seconds in a minute, so if the input is 3, the output should be 180.
30 changes: 30 additions & 0 deletions fundamentals/minutes_to_seconds/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[
{
"input": [1],
"output": 60
},
{
"input": [0],
"output": 0
},
{
"input": [3],
"output": 180
},
{
"input": [10],
"output": 600
},
{
"input": [25],
"output": 1500
},
{
"input": [-1],
"output": -60
},
{
"input": [100],
"output": 6000
}
]
Loading