Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
af31681
Create level0 category and create 2 problems
McDingus May 14, 2026
16a263f
Fix incorrect test case output
McDingus May 19, 2026
2658f4f
Create function2: parameters and return
McDingus May 20, 2026
dbb4bc1
Create Functions: Types
McDingus May 20, 2026
3c82026
Minor formatting in Functions: Parameters and Returns
McDingus May 20, 2026
41a9eba
Minor desc formatting
McDingus May 20, 2026
524bc41
Create Functions: Comparison Operators
McDingus May 20, 2026
1ca9c1e
Create Functions: If, Elif, and Else
McDingus May 20, 2026
2658770
Create Functions: Logical Operators
McDingus May 20, 2026
d2ef8d1
Move the problem definition part of the description to the end behind…
McDingus May 21, 2026
787c2ef
Add trailing newline to func6 desc
McDingus May 21, 2026
38b8bcf
Tweak problems after having a non-technical person run through them
McDingus May 21, 2026
bd80d92
Fix incorrect test case in function4
McDingus May 21, 2026
1929943
Add missing period and explain type() a little better
McDingus May 21, 2026
338f482
Create Functions: Math Operations 1 and tweak if/elif/else problem
McDingus May 22, 2026
36de75f
Fix incorrect function name in function-5
McDingus May 22, 2026
298ebc1
Create Functions: Math Operators 2
McDingus May 22, 2026
fa18803
Tweak phrasing and rename some problems less related to functions to …
McDingus May 22, 2026
af54de8
Change function names to be more relevant as I'm going to hardcode th…
McDingus May 22, 2026
d418036
Rename dirs to be easier to navigate
McDingus May 22, 2026
48a25ae
Fix incorrect meta on 6-comparison-ops
McDingus May 22, 2026
c894fdb
Fix typo in function name in get_remaining_doughnuts
McDingus May 22, 2026
289574c
Fix incorrect test suite in math-ops-1
McDingus May 22, 2026
c548b92
Add numbers before each title in Level 0
McDingus May 22, 2026
2663917
Create a bunch more problems and tweak existing ones
McDingus May 26, 2026
832fb85
Allow validate_problems to not fail on empty starter.py
McDingus May 26, 2026
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
4 changes: 0 additions & 4 deletions fundamentals/calculate-absolute/description.md

This file was deleted.

3 changes: 0 additions & 3 deletions fundamentals/calculate-absolute/starter.py

This file was deleted.

7 changes: 0 additions & 7 deletions fundamentals/is-even/description.md

This file was deleted.

3 changes: 0 additions & 3 deletions fundamentals/is-even/starter.py

This file was deleted.

25 changes: 25 additions & 0 deletions level_0/1-function-def/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
To define a new function in Python, write `def name_of_your_function():` in the code box below. Don't forget the colon!

In general, you can name functions whatever you want, but for Coding Cat the name must be exactly as the problem asks. (The problem is at the bottom)

Any lines after the definition needs to be indented. You can indent with the Tab key.

For example:
```
def new_function():
# do something
```

Note: if you want to write notes for yourself in the code, you can add comments with `#` as above. It won't affect the code execution.

<hr/>

Define a function called `return_true()` that always returns `True`.

It should look like this:
```
def return_true():
return True
```

Then hit the "Run" button below, or hit Alt + Enter!
6 changes: 6 additions & 0 deletions level_0/1-function-def/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"input": [],
"output": true
}
]
10 changes: 10 additions & 0 deletions level_0/1-function-def/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "1: Function Definition",
"name": "return_true",
"difficulty": "easy",
"author": "Luke Weaver",
"category": "Level 0",
"question_type": [
"coding"
]
}
Empty file.
54 changes: 54 additions & 0 deletions level_0/10-logical-ops/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` logical operators.

Python has three logical operators for combining conditions:
- `and`: both sides must be `True`
- `or`: at least one side must be `True`
- `not`: flips `True` to `False` and vice versa (not used in this problem but good to know!)

Example:
```
True and False → False
True or False → True
not True → False
```

When mixing `and` and `or`, like when using PEMDAS, use parentheses to prioritize operations and make your intent clear. In the order or operations, `and` comes before `or`.

Example:
```
a = True
b = True
c = False
```


```
a or b and c
True or True and False
True or [True and False] # 'and' evaluated first, True and False → False
True or False
True
```
VS
```
(a or b) and c
(True or True) and False
[(True or True)] and False # parentheses first, True or True → True
True and False
False
```
See how the parentheses affects the order of operations?


<hr/>

Write a function `check_venue_access(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise.
The function takes as input an `int` for the person's `age`, and two `bool`s for whether they have their ticket and if they are a VIP.
The rules are:
- They must be 18 or older **and** have their ticket
- **Or** they must be a VIP (VIPs always get in, no matter what)

For example:
- `check_venue_access(18, True, False)` → `True`
- `check_venue_access(20, False, False)` → `False`, they don't have their ticket
- `check_venue_access(16, False, True)` → `True`, while underage and without ticket, they are a VIP
38 changes: 38 additions & 0 deletions level_0/10-logical-ops/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[
{
"input": [18, true, false],
"output": true
},
{
"input": [20, false, false],
"output": false
},
{
"input": [16, false, true],
"output": true
},
{
"input": [25, true, false],
"output": true
},
{
"input": [25, false, false],
"output": false
},
{
"input": [16, true, false],
"output": false
},
{
"input": [16, false, false],
"output": false
},
{
"input": [16, true, true],
"output": true
},
{
"input": [25, false, true],
"output": true
}
]
10 changes: 10 additions & 0 deletions level_0/10-logical-ops/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "10: Logical Operators",
"name": "check_venue_access",
"difficulty": "easy",
"author": "Luke Weaver",
"category": "Level 0",
"question_type": [
"coding"
]
}
Empty file.
53 changes: 53 additions & 0 deletions level_0/11-if-elif-else/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
If you want to use conditions in your code, you're going to need the conditional statements `if`, `elif` and `else`.

`if` statements are formatted like this:
```
if condition:
# do things if condition == True
# do this afterwards, regardless of result
```

Example:
```
note = ""
if num > 10:
note = "number greater than 10"
return note
```

`if` statements can be paired with an `else` statement. As you might guess, the contents of `else` run when the `if` condition is `False`.

`else` statements are formatted like this:
```
note = ""
if num >= 10:
note = "num is 10 or greater"
else:
note = "num is less than 10"
return note
```

Finally, you can chain `if` statements together to make branching paths using `elif`. `elif` statements combine `else` and `if` to make a statement that only runs if the `if` above it was `False`.

Tip: You don't have to check if a `bool` is `==` to `True`, `bool`s can be their own condition! For example, if `x` is a `bool`, you can just write `if x:`, and it means the same as `if x == True:`

Example:
```
note = ""
if num >= 10:
note = "num is 10 or greater"
elif num <= 5: # only checks this if num >= 10 is False
note = "num is 5 or less"
else:
note = "num is between 6 and 9"
return note
```

<hr/>

Write a function `if_elif_else(bool1, bool2)` that takes two booleans as input. If `bool1` is `True` it should return `1`, elif `bool2` is `True` it should return `2`, else return `0`.

Some examples:
- `if_elif_else(True, False)` → `1`
- `if_elif_else(False, True)` → `2`
- `if_elif_else(False, False)` → `0`
18 changes: 18 additions & 0 deletions level_0/11-if-elif-else/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"input": [true, false],
"output": 1
},
{
"input": [false, true],
"output": 2
},
{
"input": [true, true],
"output": 1
},
{
"input": [false, false],
"output": 0
}
]
10 changes: 10 additions & 0 deletions level_0/11-if-elif-else/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "11: If, Elif, and Else Statements",
"name": "if_elif_else",
"difficulty": "easy",
"author": "Luke Weaver",
"category": "Level 0",
"question_type": [
"coding"
]
}
Empty file.
43 changes: 43 additions & 0 deletions level_0/2-params-return/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<strong>Parameters</strong>

Parameters are where functions get a little more dynamic. Values are passed to the function in the parentheses `()` after the name when it is called, and then they are available within the function as variables.

For example, if you defined a function called `function2` with two parameters like this:
```
def function2(num1, num2):
# do stuff
```

If you were to run `function2(10, 25)`:
- This is calling `function2` with 10 and 25
- In this execution, `num1` = 10 and `num2` = 25

<hr/>

<strong>Return Statements</strong>

`return` statements are how you get things out of functions. Coding Cat takes the function you write and passes it a set list of inputs, and checks the expected result against what your code returns.

For example:
```
def get_difference(num1, num2):
diff = num1 - num2
return diff

# Running `get_difference(10, 25)` would return -15.
```

You can create your own variables like I did with `diff` here, simply give it a name and a value!

If you aren't sure how your code is running, `print` statements can help you figure that out! Just be sure to remove them later once you know everything works!

<hr/>

Write a function `sum_nums(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum.

For example:
- `sum_nums(10, 25)` → `35`
- `sum_nums(1, 1)` → `2`
- `sum_nums(-5, -5)` → `-10`

Note: Try writing `print(num1)` in your `sum_nums` and see what happens!
22 changes: 22 additions & 0 deletions level_0/2-params-return/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[
{
"input": [10, 25],
"output": 35
},
{
"input": [1, 1],
"output": 2
},
{
"input": [-5, -5],
"output": -10
},
{
"input": [1000, 750],
"output": 1750
},
{
"input": [0, 0],
"output": 0
}
]
10 changes: 10 additions & 0 deletions level_0/2-params-return/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"title": "2: Function Parameters and Returns",
"name": "sum_nums",
"difficulty": "easy",
"author": "Luke Weaver",
"category": "Level 0",
"question_type": [
"coding"
]
}
Empty file.
35 changes: 35 additions & 0 deletions level_0/3-types/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
To do more with functions, we're going to have to learn about data types.

In Python, there are many data types, but the most common ones you'll see on Coding Cat are `bool`, `int`, `float` and `str`.

- `bool`: Boolean, it can be `True` or `False`. That's it.

- `int`: Integer, positive or negative whole numbers.
- `float`: Floating Point number, a number with a decimal value. Whole number floats still have a decimal value of .0 (ex: `10.0`).

- `str`: String, a sequence of 0 or more characters (not just letters) wrapped in quotes (`''`/`""`).
- "Eric"
- ""
- 'fdajfndsjl nfjnsh vgfvbgf'
- "50" (While this looks like an `int`, the quotes mean it is a `str`)

There are quite a few more types to learn about, but to keep things simple, these are just some to start with. For more information on types, check out [this blog post]()

You can get the type of a variable by passing it to a pre-made Python function called `type()` by putting the variable within the parentheses like so: `type(variable_name)`. `type().__name__` returns a `str` that represents the type of variable entered.

Example:
```
x = 5
y = "hello"
z = False
```

- `type(x).__name__` → `'int'`
- `type(y).__name__` → `'str'`
- `type(z).__name__` → `'bool'`

<br/>

Have a look at the starter code. There is already a function called `get_var_type(var)`. When you hit run, `get_var_type()` will be passed different types of variables. We want it to return each variable's type as a `str`.

**It currently only returns the type of the variable `number`, we want it to use `var`. Do not touch `__name__`.**
18 changes: 18 additions & 0 deletions level_0/3-types/io.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"input": [5],
"output": "int"
},
{
"input": ["howdy"],
"output": "str"
},
{
"input": [true],
"output": "bool"
},
{
"input": [5.6],
"output": "float"
}
]
Loading
Loading