From af31681f3cb60745f61a6483591176c182459bee Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Thu, 14 May 2026 15:35:49 -0400 Subject: [PATCH 01/26] Create level0 category and create 2 problems --- level_0/function-1/description.md | 15 +++++++++++ level_0/function-1/io.json | 6 +++++ level_0/function-1/meta.json | 10 ++++++++ level_0/function-1/starter.py | 0 level_0/function-2/description.md | 13 ++++++++++ level_0/function-2/io.json | 22 ++++++++++++++++ level_0/function-2/meta.json | 10 ++++++++ level_0/function-2/starter.py | 0 logic/two-or-three/description.md | 7 ------ logic/two-or-three/io.json | 42 ------------------------------- logic/two-or-three/meta.json | 10 -------- logic/two-or-three/starter.py | 3 --- 12 files changed, 76 insertions(+), 62 deletions(-) create mode 100644 level_0/function-1/description.md create mode 100644 level_0/function-1/io.json create mode 100644 level_0/function-1/meta.json create mode 100644 level_0/function-1/starter.py create mode 100644 level_0/function-2/description.md create mode 100644 level_0/function-2/io.json create mode 100644 level_0/function-2/meta.json create mode 100644 level_0/function-2/starter.py delete mode 100644 logic/two-or-three/description.md delete mode 100644 logic/two-or-three/io.json delete mode 100644 logic/two-or-three/meta.json delete mode 100644 logic/two-or-three/starter.py diff --git a/level_0/function-1/description.md b/level_0/function-1/description.md new file mode 100644 index 00000000..6e492ed0 --- /dev/null +++ b/level_0/function-1/description.md @@ -0,0 +1,15 @@ +Write a function called `function1()` that always returns `True`. + +The format to define a new function in Python is `def function_name():`. Don't forget the colon! + +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 running code. + +For the moment, all the function should contain is `return True`. We'll cover `return` statements in the next problem. \ No newline at end of file diff --git a/level_0/function-1/io.json b/level_0/function-1/io.json new file mode 100644 index 00000000..e6fb3807 --- /dev/null +++ b/level_0/function-1/io.json @@ -0,0 +1,6 @@ +[ + { + "input": [], + "output": true + } +] \ No newline at end of file diff --git a/level_0/function-1/meta.json b/level_0/function-1/meta.json new file mode 100644 index 00000000..e1d64a08 --- /dev/null +++ b/level_0/function-1/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: Definition", + "name": "function1", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-1/starter.py b/level_0/function-1/starter.py new file mode 100644 index 00000000..e69de29b diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md new file mode 100644 index 00000000..c18df5d6 --- /dev/null +++ b/level_0/function-2/description.md @@ -0,0 +1,13 @@ +Write a function `function2(num1, num2):` that takes in 2 numbers, `num1` and `num2` and returns their sum. + +Parameters are where functions get a little more dynamic. Values are passed to the function when it is called, and then they are available in the function as variables. + +Example: + +`function2(10, 25)` +* This is calling function2 with two numbers, 10 and 25 +* In this execution, `num1` = 10 and `num2` = 25 + +`print` statements can help you figure out what's going on inside functions when they run. Just be sure to remove them later once you know everything works! + +Try writing `print(num1)` in function2 and see what happens! \ No newline at end of file diff --git a/level_0/function-2/io.json b/level_0/function-2/io.json new file mode 100644 index 00000000..5cfe6689 --- /dev/null +++ b/level_0/function-2/io.json @@ -0,0 +1,22 @@ +[ + { + "input": [10, 25], + "output": 35 + }, + { + "input": [1, 1], + "output": 2 + }, + { + "input": [1000, 750], + "output": 1750 + }, + { + "input": [-5, -5], + "output": -10 + }, + { + "input": [0, 0], + "output": 0 + } +] \ No newline at end of file diff --git a/level_0/function-2/meta.json b/level_0/function-2/meta.json new file mode 100644 index 00000000..e3d953ee --- /dev/null +++ b/level_0/function-2/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: Parameters", + "name": "function2", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-2/starter.py b/level_0/function-2/starter.py new file mode 100644 index 00000000..e69de29b diff --git a/logic/two-or-three/description.md b/logic/two-or-three/description.md deleted file mode 100644 index 62bf7b2a..00000000 --- a/logic/two-or-three/description.md +++ /dev/null @@ -1,7 +0,0 @@ -Write a function `two_or_three(n: int) -> bool` that takes an integer `n` and returns `True` if `n` is a multiple of *either* 2 or 3, and `False` if `n` is a multiple of both or neither. - -For example: -- `two_or_three(4) → True` as 4 is a multiple of 2 and not 3. -- `two_or_three(9) → True` as 9 is a multiple of 3 and not 2. -- `two_or_three(6) → False` as 6 is a multiple of both 2 and 3. -- `two_or_three(7) → False` as 7 is a multiple of neither 2 nor 3. diff --git a/logic/two-or-three/io.json b/logic/two-or-three/io.json deleted file mode 100644 index 909c1371..00000000 --- a/logic/two-or-three/io.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "input": [6], - "output": false - }, - { - "input": [4], - "output": true - }, - { - "input": [9], - "output": true - }, - { - "input": [7], - "output": false - }, - { - "input": [3], - "output": true - }, - { - "input": [-6], - "output": false - }, - { - "input": [-3], - "output": true - }, - { - "input": [55], - "output": false - }, - { - "input": [0], - "output": false - }, - { - "input": [11], - "output": false - } -] diff --git a/logic/two-or-three/meta.json b/logic/two-or-three/meta.json deleted file mode 100644 index ecc247ae..00000000 --- a/logic/two-or-three/meta.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "Two or Three", - "name": "two_or_three", - "difficulty": "medium", - "author": "ChatGPT", - "category": "Logic", - "question_type": [ - "coding" - ] -} \ No newline at end of file diff --git a/logic/two-or-three/starter.py b/logic/two-or-three/starter.py deleted file mode 100644 index 35be1a9a..00000000 --- a/logic/two-or-three/starter.py +++ /dev/null @@ -1,3 +0,0 @@ -def two_or_three(n: int) -> bool: - # Your code here - pass \ No newline at end of file From 16a263f629534d335bdd0fe5946215390c2e7e07 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Tue, 19 May 2026 16:25:16 -0400 Subject: [PATCH 02/26] Fix incorrect test case output --- list_2_iterating/same-value/io.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/list_2_iterating/same-value/io.json b/list_2_iterating/same-value/io.json index e47ade1e..65cf2ac8 100644 --- a/list_2_iterating/same-value/io.json +++ b/list_2_iterating/same-value/io.json @@ -99,7 +99,7 @@ -8 ] ], - "output": false + "output": true }, { "input": [ From 2658f4f26bcc0398d7f7e115793e583369aef9b4 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 09:40:37 -0400 Subject: [PATCH 03/26] Create function2: parameters and return --- level_0/function-2/description.md | 19 +++++++++++++++---- level_0/function-2/meta.json | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md index c18df5d6..83ad2019 100644 --- a/level_0/function-2/description.md +++ b/level_0/function-2/description.md @@ -1,13 +1,24 @@ Write a function `function2(num1, num2):` that takes in 2 numbers, `num1` and `num2` and returns their sum. -Parameters are where functions get a little more dynamic. Values are passed to the function when it is called, and then they are available in the function as variables. +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. Example: `function2(10, 25)` -* This is calling function2 with two numbers, 10 and 25 +* This is calling function2 with 10 and 25 * In this execution, `num1` = 10 and `num2` = 25 -`print` statements can help you figure out what's going on inside functions when they run. Just be sure to remove them later once you know everything works! +`return` statements are how you get things out of functions. Coding Cat takes the function you write and passes a set list of inputs, and checks the expected result against what your code returns. -Try writing `print(num1)` in function2 and see what happens! \ No newline at end of file +For example: +``` +def get_difference(num1, num2): + diff = num1 - num2 + return diff + +# Running `get_difference(10, 25)` would return -15. +``` + +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! + +Try writing `print(num1)` in your `function2` and see what happens! \ No newline at end of file diff --git a/level_0/function-2/meta.json b/level_0/function-2/meta.json index e3d953ee..caf91ec8 100644 --- a/level_0/function-2/meta.json +++ b/level_0/function-2/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Parameters", + "title": "Functions: Parameters and Returns", "name": "function2", "difficulty": "easy", "author": "", From dbb4bc1709996fdf4715ff8f8c737409765f888a Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 12:24:50 -0400 Subject: [PATCH 04/26] Create Functions: Types --- level_0/function-3/description.md | 26 ++++++++++++++++++++++++++ level_0/function-3/io.json | 18 ++++++++++++++++++ level_0/function-3/meta.json | 10 ++++++++++ level_0/function-3/starter.py | 3 +++ 4 files changed, 57 insertions(+) create mode 100644 level_0/function-3/description.md create mode 100644 level_0/function-3/io.json create mode 100644 level_0/function-3/meta.json create mode 100644 level_0/function-3/starter.py diff --git a/level_0/function-3/description.md b/level_0/function-3/description.md new file mode 100644 index 00000000..ca4ca84f --- /dev/null +++ b/level_0/function-3/description.md @@ -0,0 +1,26 @@ +Write a function `function3(var)` that takes as input a value (it could be anything) and returns its type. + +To complete this problem, 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 running `type()` on it. Have a look at the starter code. *Don't worry about `__name__`, it will not come up* This function will return a `str` representing the type of the variable `number`. It currently does not use `var`. + +For example: +`num = 5, word = "hello", no = False` +- `type(num).__name__ → 'int'` +- `type(word).__name__ → 'str'` +- `type(no)__name__ → 'bool'` diff --git a/level_0/function-3/io.json b/level_0/function-3/io.json new file mode 100644 index 00000000..43435e9e --- /dev/null +++ b/level_0/function-3/io.json @@ -0,0 +1,18 @@ +[ + { + "input": [5], + "output": "int" + }, + { + "input": ["howdy"], + "output": "str" + }, + { + "input": [true], + "output": "bool" + }, + { + "input": [5.6], + "output": "float" + } +] \ No newline at end of file diff --git a/level_0/function-3/meta.json b/level_0/function-3/meta.json new file mode 100644 index 00000000..e21162e2 --- /dev/null +++ b/level_0/function-3/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: Types", + "name": "function3", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-3/starter.py b/level_0/function-3/starter.py new file mode 100644 index 00000000..243b37d3 --- /dev/null +++ b/level_0/function-3/starter.py @@ -0,0 +1,3 @@ +def function3(var): + number = 5 + return type(number).__name__ \ No newline at end of file From 3c820266a372c98689b23dd88dc789cbde5b4c5d Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 12:25:31 -0400 Subject: [PATCH 05/26] Minor formatting in Functions: Parameters and Returns --- level_0/function-2/description.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md index 83ad2019..b8f18062 100644 --- a/level_0/function-2/description.md +++ b/level_0/function-2/description.md @@ -2,6 +2,8 @@ Write a function `function2(num1, num2):` that takes in 2 numbers, `num1` and `n 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. +You can call the parameters whatever you want, `num1` and `num2` are just suggestions. + Example: `function2(10, 25)` @@ -19,6 +21,8 @@ def get_difference(num1, num2): # 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! Try writing `print(num1)` in your `function2` and see what happens! \ No newline at end of file From 41a9eba30bc4b48ea470ed07fcbb634575c66c9e Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 13:54:33 -0400 Subject: [PATCH 06/26] Minor desc formatting --- level_0/function-2/description.md | 4 ++-- level_0/function-3/description.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md index b8f18062..d4aa9e17 100644 --- a/level_0/function-2/description.md +++ b/level_0/function-2/description.md @@ -1,8 +1,8 @@ -Write a function `function2(num1, num2):` that takes in 2 numbers, `num1` and `num2` and returns their sum. +Write a function `function2(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum. 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. -You can call the parameters whatever you want, `num1` and `num2` are just suggestions. +For any function you write, you can call the parameters whatever you want, `num1` and `num2` are just suggestions. Example: diff --git a/level_0/function-3/description.md b/level_0/function-3/description.md index ca4ca84f..98122f66 100644 --- a/level_0/function-3/description.md +++ b/level_0/function-3/description.md @@ -17,7 +17,7 @@ In Python, there are many data types, but the most common ones you'll see on Cod 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 running `type()` on it. Have a look at the starter code. *Don't worry about `__name__`, it will not come up* This function will return a `str` representing the type of the variable `number`. It currently does not use `var`. +You can get the type of a variable by running `type()` on it. Have a look at the starter code. *Don't worry about `__name__`, it will not come up in later problems.* This function will return a `str` representing the type of the variable `number`. It currently does not use `var`. For example: `num = 5, word = "hello", no = False` From 524bc417e88030d2972f03bc1874ef70278e5c3b Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 14:29:28 -0400 Subject: [PATCH 07/26] Create Functions: Comparison Operators --- level_0/function-4/description.md | 21 +++++++++++++++++++++ level_0/function-4/io.json | 22 ++++++++++++++++++++++ level_0/function-4/meta.json | 10 ++++++++++ level_0/function-4/starter.py | 0 4 files changed, 53 insertions(+) create mode 100644 level_0/function-4/description.md create mode 100644 level_0/function-4/io.json create mode 100644 level_0/function-4/meta.json create mode 100644 level_0/function-4/starter.py diff --git a/level_0/function-4/description.md b/level_0/function-4/description.md new file mode 100644 index 00000000..993a6467 --- /dev/null +++ b/level_0/function-4/description.md @@ -0,0 +1,21 @@ +Write a function `function4(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. + +Now that we know about booleans, we can move on to operators that use and compare them. + +There are a couple ways to compare two values: +- `==`: returns `True` if the values are equal in value and `False` otherwise. + - `5 == 5` → `True` + - `"word" == 'word'` → `True` (the single VS double quotes do not change the value) + - `"word" == "Word"` → `False` (capitalization matter when using `str`!!) + - `5 == "5"` → `False` (one is an `int`, the other a `str`) + +- `!=`: returns `True` if values are **not** equal in value and `False` otherwise. The opposite of the previous operator. + - `5 != 5` → `False` + - `"word" != 'word'` → `False` + - `5 != "5"` → `True` + +- `>` / `<` / `>=` / `<=`: works the same as it does in math. Returns `True` if the equality is true, and `False` otherwise. + - `5 < 10` → `True` + - `2 > 5` → `False` + - `20 >= 20` → `True` + - `1 > 1` → `False` diff --git a/level_0/function-4/io.json b/level_0/function-4/io.json new file mode 100644 index 00000000..8db9ba32 --- /dev/null +++ b/level_0/function-4/io.json @@ -0,0 +1,22 @@ +[ + { + "input": [5], + "output": false + }, + { + "input": [11], + "output": true + }, + { + "input": [10], + "output": false + }, + { + "input": [100000], + "output": true + }, + { + "input": [-10], + "output": false + } +] \ No newline at end of file diff --git a/level_0/function-4/meta.json b/level_0/function-4/meta.json new file mode 100644 index 00000000..2e607553 --- /dev/null +++ b/level_0/function-4/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: Comparison Operators", + "name": "function4", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-4/starter.py b/level_0/function-4/starter.py new file mode 100644 index 00000000..e69de29b From 1ca9c1e5863d77be2b2221862c84150c97085066 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 15:02:21 -0400 Subject: [PATCH 08/26] Create Functions: If, Elif, and Else --- level_0/function-6/description.md | 35 +++++++++++++++++++++++++++++++ level_0/function-6/io.json | 18 ++++++++++++++++ level_0/function-6/meta.json | 10 +++++++++ level_0/function-6/starter.py | 0 4 files changed, 63 insertions(+) create mode 100644 level_0/function-6/description.md create mode 100644 level_0/function-6/io.json create mode 100644 level_0/function-6/meta.json create mode 100644 level_0/function-6/starter.py diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md new file mode 100644 index 00000000..6d2a3252 --- /dev/null +++ b/level_0/function-6/description.md @@ -0,0 +1,35 @@ +Write a function `function6(bool1, bool2)` that takes two booleans as input, and returns `"bool1"` if `bool1` is `True`, otherwise return `"bool2"` if `bool2` is `True`, otherwise return `"nope"`. + +This problem will require the conditional statements `if`, `elif` and `else`. + +`if` statements are formatted like this: +``` +if num > 10: + # if num is greater than 10, do this +# do this afterwards, regardless of num +``` + +`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: +``` +if num >= 10: + # if num is 10 or greater, do this +else: + # otherwise, do this +# do this afterwards, regardless of num +``` + +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`. + +Example: +``` +if num >= 10: + # if num is 10 or greater, do this +elif num <= 5: + # skipped if num >= 10 is True + # if num is 5 or less, do this +else: + # if all above was False (num is between 6 and 9), do this +# do this afterwards, regardless of num +``` \ No newline at end of file diff --git a/level_0/function-6/io.json b/level_0/function-6/io.json new file mode 100644 index 00000000..c6de8f02 --- /dev/null +++ b/level_0/function-6/io.json @@ -0,0 +1,18 @@ +[ + { + "input": [true, false], + "output": "bool1" + }, + { + "input": [false, true], + "output": "bool2" + }, + { + "input": [true, true], + "output": "bool1" + }, + { + "input": [false, false], + "output": "nope" + } +] \ No newline at end of file diff --git a/level_0/function-6/meta.json b/level_0/function-6/meta.json new file mode 100644 index 00000000..8cb528d0 --- /dev/null +++ b/level_0/function-6/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: If, Elif, and Else", + "name": "function6", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-6/starter.py b/level_0/function-6/starter.py new file mode 100644 index 00000000..e69de29b From 2658770e20575b0f7c88a8f00177f57092387937 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Wed, 20 May 2026 15:40:34 -0400 Subject: [PATCH 09/26] Create Functions: Logical Operators --- level_0/function-5/description.md | 49 +++++++++++++++++++++++++++++++ level_0/function-5/io.json | 30 +++++++++++++++++++ level_0/function-5/meta.json | 10 +++++++ level_0/function-5/starter.py | 0 4 files changed, 89 insertions(+) create mode 100644 level_0/function-5/description.md create mode 100644 level_0/function-5/io.json create mode 100644 level_0/function-5/meta.json create mode 100644 level_0/function-5/starter.py diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md new file mode 100644 index 00000000..d5bdd177 --- /dev/null +++ b/level_0/function-5/description.md @@ -0,0 +1,49 @@ +Write a function `function5(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. +The function takes as input and `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: +- `function5(18, True, False)` → `True` +- `function5(20, False, False)` → `False`, they don't have their ticket +- `function5(16, False, True)` → `True`, while underage and without ticket, they are a VIP + +This problem will require us to learn about 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`, use parentheses to 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 or False +True +``` +VS +``` +(a or b) and c +(True or True) and False # parentheses first +True and False +False # different result! +``` diff --git a/level_0/function-5/io.json b/level_0/function-5/io.json new file mode 100644 index 00000000..46ca9059 --- /dev/null +++ b/level_0/function-5/io.json @@ -0,0 +1,30 @@ +[ + { + "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, false, true], + "output": true + }, + { + "input": [16, true, true], + "output": true + }, + { + "input": [25, false, true], + "output": true + } +] \ No newline at end of file diff --git a/level_0/function-5/meta.json b/level_0/function-5/meta.json new file mode 100644 index 00000000..c5e5822f --- /dev/null +++ b/level_0/function-5/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: Logical Operators", + "name": "function4", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-5/starter.py b/level_0/function-5/starter.py new file mode 100644 index 00000000..e69de29b From d2ef8d112cd5e4fad27957f7e7d23dfead47ea48 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Thu, 21 May 2026 10:32:10 -0400 Subject: [PATCH 10/26] Move the problem definition part of the description to the end behind a horizontal line to have it right next to the code block --- level_0/function-1/description.md | 2 +- level_0/function-2/description.md | 13 ++++++++++--- level_0/function-2/io.json | 8 ++++---- level_0/function-4/description.md | 13 ++++++++++--- level_0/function-5/description.md | 26 ++++++++++++++------------ level_0/function-6/description.md | 10 ++++++---- 6 files changed, 45 insertions(+), 27 deletions(-) diff --git a/level_0/function-1/description.md b/level_0/function-1/description.md index 6e492ed0..484cd00a 100644 --- a/level_0/function-1/description.md +++ b/level_0/function-1/description.md @@ -1,6 +1,6 @@ Write a function called `function1()` that always returns `True`. -The format to define a new function in Python is `def function_name():`. Don't forget the colon! +To define a new function in Python, write `def function_name():` in the code box below. Don't forget the colon! Any lines after the definition needs to be indented. You can indent with the Tab key. diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md index d4aa9e17..26bd29eb 100644 --- a/level_0/function-2/description.md +++ b/level_0/function-2/description.md @@ -1,5 +1,3 @@ -Write a function `function2(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum. - 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 any function you write, you can call the parameters whatever you want, `num1` and `num2` are just suggestions. @@ -25,4 +23,13 @@ You can create your own variables like I did with `diff` here, simply give it a 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! -Try writing `print(num1)` in your `function2` and see what happens! \ No newline at end of file +Try writing `print(num1)` in your `function2` and see what happens! + +
+ +Write a function `function2(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum. + +For example: +- `function2(10, 25)` → `35` +- `function2(1, 1)` → `2` +- `function2(-5, -5)` → `-10` \ No newline at end of file diff --git a/level_0/function-2/io.json b/level_0/function-2/io.json index 5cfe6689..0df96ada 100644 --- a/level_0/function-2/io.json +++ b/level_0/function-2/io.json @@ -7,14 +7,14 @@ "input": [1, 1], "output": 2 }, - { - "input": [1000, 750], - "output": 1750 - }, { "input": [-5, -5], "output": -10 }, + { + "input": [1000, 750], + "output": 1750 + }, { "input": [0, 0], "output": 0 diff --git a/level_0/function-4/description.md b/level_0/function-4/description.md index 993a6467..e172f9d6 100644 --- a/level_0/function-4/description.md +++ b/level_0/function-4/description.md @@ -1,6 +1,4 @@ -Write a function `function4(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. - -Now that we know about booleans, we can move on to operators that use and compare them. +If you want to compare multiple values to each other, you're going to need to know about some comparison operators. There are a couple ways to compare two values: - `==`: returns `True` if the values are equal in value and `False` otherwise. @@ -19,3 +17,12 @@ There are a couple ways to compare two values: - `2 > 5` → `False` - `20 >= 20` → `True` - `1 > 1` → `False` + +
+ +Write a function `function4(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. + +For example: +- `function4(5)` → `False` +- `function4(11)` → `True` +- `function4(10)` → `True` diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index d5bdd177..84b457ee 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -1,15 +1,4 @@ -Write a function `function5(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. -The function takes as input and `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: -- `function5(18, True, False)` → `True` -- `function5(20, False, False)` → `False`, they don't have their ticket -- `function5(16, False, True)` → `True`, while underage and without ticket, they are a VIP - -This problem will require us to learn about the `and` and `or` logical operators. +If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` keywords. Python has three logical operators for combining conditions: - `and`: both sides must be `True` @@ -47,3 +36,16 @@ VS True and False False # different result! ``` + +
+ +Write a function `function5(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. +The function takes as input and `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: +- `function5(18, True, False)` → `True` +- `function5(20, False, False)` → `False`, they don't have their ticket +- `function5(16, False, True)` → `True`, while underage and without ticket, they are a VIP diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md index 6d2a3252..e8ad93fb 100644 --- a/level_0/function-6/description.md +++ b/level_0/function-6/description.md @@ -1,6 +1,4 @@ -Write a function `function6(bool1, bool2)` that takes two booleans as input, and returns `"bool1"` if `bool1` is `True`, otherwise return `"bool2"` if `bool2` is `True`, otherwise return `"nope"`. - -This problem will require the conditional statements `if`, `elif` and `else`. +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: ``` @@ -32,4 +30,8 @@ elif num <= 5: else: # if all above was False (num is between 6 and 9), do this # do this afterwards, regardless of num -``` \ No newline at end of file +``` + +
+ +Write a function `function6(bool1, bool2)` that takes two booleans as input, and returns `"bool1"` if `bool1` is `True`, otherwise return `"bool2"` if `bool2` is `True`, otherwise return `"nope"`. \ No newline at end of file From 787c2efe520a0d5eec41a8c328022559c7683201 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Thu, 21 May 2026 10:35:00 -0400 Subject: [PATCH 11/26] Add trailing newline to func6 desc --- level_0/function-6/description.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md index e8ad93fb..570aac17 100644 --- a/level_0/function-6/description.md +++ b/level_0/function-6/description.md @@ -34,4 +34,4 @@ else:
-Write a function `function6(bool1, bool2)` that takes two booleans as input, and returns `"bool1"` if `bool1` is `True`, otherwise return `"bool2"` if `bool2` is `True`, otherwise return `"nope"`. \ No newline at end of file +Write a function `function6(bool1, bool2)` that takes two booleans as input, and returns `"bool1"` if `bool1` is `True`, otherwise return `"bool2"` if `bool2` is `True`, otherwise return `"nope"`. From 38b8bcf6f190df7d77665d835b722a8d14c38ec0 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Thu, 21 May 2026 15:32:24 -0400 Subject: [PATCH 12/26] Tweak problems after having a non-technical person run through them --- level_0/function-1/description.md | 6 ++++-- level_0/function-3/description.md | 8 ++++---- level_0/function-5/description.md | 11 +++++++---- level_0/function-5/io.json | 16 ++++++++++++---- level_0/function-5/meta.json | 2 +- level_0/function-6/description.md | 30 ++++++++++++++++++------------ level_0/function-6/io.json | 8 ++++---- 7 files changed, 50 insertions(+), 31 deletions(-) diff --git a/level_0/function-1/description.md b/level_0/function-1/description.md index 484cd00a..a554b0f5 100644 --- a/level_0/function-1/description.md +++ b/level_0/function-1/description.md @@ -1,5 +1,3 @@ -Write a function called `function1()` that always returns `True`. - To define a new function in Python, write `def function_name():` in the code box below. Don't forget the colon! Any lines after the definition needs to be indented. You can indent with the Tab key. @@ -12,4 +10,8 @@ def new_function(): Note: if you want to write notes for yourself in the code, you can add comments with `#` as above. It won't affect the running code. +
+ +Define a function called `function1()` that always returns `True`. + For the moment, all the function should contain is `return True`. We'll cover `return` statements in the next problem. \ No newline at end of file diff --git a/level_0/function-3/description.md b/level_0/function-3/description.md index 98122f66..0007b7d1 100644 --- a/level_0/function-3/description.md +++ b/level_0/function-3/description.md @@ -1,6 +1,4 @@ -Write a function `function3(var)` that takes as input a value (it could be anything) and returns its type. - -To complete this problem, we're going to have to learn about data types. +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`. @@ -17,10 +15,12 @@ In Python, there are many data types, but the most common ones you'll see on Cod 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 running `type()` on it. Have a look at the starter code. *Don't worry about `__name__`, it will not come up in later problems.* This function will return a `str` representing the type of the variable `number`. It currently does not use `var`. +You can get the type of a variable by passing it to a pre-made Python function called `type(variable_name)`. Have a look at the starter code. *Don't worry about `__name__`, it will not come up in later problems.* This function will return a `str` representing the type of the variable `number`. **It currently does not use `var`.** For example: `num = 5, word = "hello", no = False` - `type(num).__name__ → 'int'` - `type(word).__name__ → 'str'` - `type(no)__name__ → 'bool'` + + diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index 84b457ee..2dff0982 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -12,7 +12,7 @@ True or False → True not True → False ``` -When mixing `and` and `or`, use parentheses to make your intent clear. In the order or operations, `and` comes before `or`. +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: ``` @@ -25,17 +25,20 @@ c = False ``` a or b and c True or True and False -True or (True and False) # 'and' evaluated first +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 # parentheses first +(True or True) and False +[(True or True)] and False # parentheses first, True or True → True True and False -False # different result! +False ``` +See how the parentheses affects the order of operations? +
diff --git a/level_0/function-5/io.json b/level_0/function-5/io.json index 46ca9059..b1bf83f8 100644 --- a/level_0/function-5/io.json +++ b/level_0/function-5/io.json @@ -1,4 +1,16 @@ [ + { + "input": [18, true, false], + "output": true + }, + { + "input": [20, false, false], + "output": false + }, + { + "input": [16, false, true], + "output": true + }, { "input": [25, true, false], "output": true @@ -15,10 +27,6 @@ "input": [16, false, false], "output": false }, - { - "input": [16, false, true], - "output": true - }, { "input": [16, true, true], "output": true diff --git a/level_0/function-5/meta.json b/level_0/function-5/meta.json index c5e5822f..7c93e57a 100644 --- a/level_0/function-5/meta.json +++ b/level_0/function-5/meta.json @@ -1,6 +1,6 @@ { "title": "Functions: Logical Operators", - "name": "function4", + "name": "function5", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md index 570aac17..03aeb9a3 100644 --- a/level_0/function-6/description.md +++ b/level_0/function-6/description.md @@ -2,9 +2,16 @@ If you want to use conditions in your code, you're going to need the conditional `if` statements are formatted like this: ``` +if condition: + # do things +# do this afterwards, regardless of result +``` + +Example: +``` if num > 10: - # if num is greater than 10, do this -# do this afterwards, regardless of num + comment = "number greater than 10" +return comment ``` `if` statements can be paired with an `else` statement. As you might guess, the contents of `else` run when the `if` condition is `False`. @@ -12,10 +19,10 @@ if num > 10: `else` statements are formatted like this: ``` if num >= 10: - # if num is 10 or greater, do this + comment = "num is 10 or greater" else: - # otherwise, do this -# do this afterwards, regardless of num + comment = "num is less than 10" +return comment ``` 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`. @@ -23,15 +30,14 @@ Finally, you can chain `if` statements together to make branching paths using `e Example: ``` if num >= 10: - # if num is 10 or greater, do this -elif num <= 5: - # skipped if num >= 10 is True - # if num is 5 or less, do this + comment = "num is 10 or greater" +elif num <= 5: # only checks this is num < 10 + comment = "num is 5 or less" else: - # if all above was False (num is between 6 and 9), do this -# do this afterwards, regardless of num + comment = "num is between 6 and 9" +return comment ```
-Write a function `function6(bool1, bool2)` that takes two booleans as input, and returns `"bool1"` if `bool1` is `True`, otherwise return `"bool2"` if `bool2` is `True`, otherwise return `"nope"`. +Write a function `function6(bool1, bool2)` that takes two booleans as input. If `bool1` is `True` it should return `1`, otherwise if `bool2` is `True` it should return `2`, else return `0`. diff --git a/level_0/function-6/io.json b/level_0/function-6/io.json index c6de8f02..6a0b4716 100644 --- a/level_0/function-6/io.json +++ b/level_0/function-6/io.json @@ -1,18 +1,18 @@ [ { "input": [true, false], - "output": "bool1" + "output": 1 }, { "input": [false, true], - "output": "bool2" + "output": 2 }, { "input": [true, true], - "output": "bool1" + "output": 1 }, { "input": [false, false], - "output": "nope" + "output": 0 } ] \ No newline at end of file From bd80d92562eb8b1a260489d5ebdeaed503f7484a Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Thu, 21 May 2026 15:36:57 -0400 Subject: [PATCH 13/26] Fix incorrect test case in function4 --- level_0/function-4/io.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/level_0/function-4/io.json b/level_0/function-4/io.json index 8db9ba32..2fb673e8 100644 --- a/level_0/function-4/io.json +++ b/level_0/function-4/io.json @@ -9,7 +9,7 @@ }, { "input": [10], - "output": false + "output": true }, { "input": [100000], From 1929943a0839722c2cefb6b0d0e5b93d47bd8365 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Thu, 21 May 2026 15:44:47 -0400 Subject: [PATCH 14/26] Add missing period and explain type() a little better --- level_0/function-3/description.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/level_0/function-3/description.md b/level_0/function-3/description.md index 0007b7d1..0c30d73a 100644 --- a/level_0/function-3/description.md +++ b/level_0/function-3/description.md @@ -15,12 +15,14 @@ In Python, there are many data types, but the most common ones you'll see on Cod 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(variable_name)`. Have a look at the starter code. *Don't worry about `__name__`, it will not come up in later problems.* This function will return a `str` representing the type of the variable `number`. **It currently does not use `var`.** +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)`. + +Have a look at the starter code. *Don't worry about `__name__`, it will not come up in later problems.* This function will return a `str` representing the type of the variable `number`. **It currently does not use `var`.** For example: `num = 5, word = "hello", no = False` - `type(num).__name__ → 'int'` - `type(word).__name__ → 'str'` -- `type(no)__name__ → 'bool'` +- `type(no).__name__ → 'bool'` From 338f4822a2298041f27005dcfdb53eddff2bd448 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 11:06:17 -0400 Subject: [PATCH 15/26] Create Functions: Math Operations 1 and tweak if/elif/else problem --- level_0/function-4/description.md | 41 +++++++++--------- level_0/function-4/io.json | 18 +------- level_0/function-4/meta.json | 2 +- level_0/function-5/description.md | 72 ++++++++++--------------------- level_0/function-5/io.json | 44 ++++++------------- level_0/function-5/meta.json | 2 +- level_0/function-6/description.md | 65 ++++++++++++++++------------ level_0/function-6/io.json | 44 +++++++++++++------ level_0/function-6/meta.json | 2 +- level_0/function-7/description.md | 53 +++++++++++++++++++++++ level_0/function-7/io.json | 18 ++++++++ level_0/function-7/meta.json | 10 +++++ level_0/function-7/starter.py | 0 13 files changed, 212 insertions(+), 159 deletions(-) create mode 100644 level_0/function-7/description.md create mode 100644 level_0/function-7/io.json create mode 100644 level_0/function-7/meta.json create mode 100644 level_0/function-7/starter.py diff --git a/level_0/function-4/description.md b/level_0/function-4/description.md index e172f9d6..d7a4fc65 100644 --- a/level_0/function-4/description.md +++ b/level_0/function-4/description.md @@ -1,28 +1,27 @@ -If you want to compare multiple values to each other, you're going to need to know about some comparison operators. +Python can be used like a calculator, if you know how to use math operators. -There are a couple ways to compare two values: -- `==`: returns `True` if the values are equal in value and `False` otherwise. - - `5 == 5` → `True` - - `"word" == 'word'` → `True` (the single VS double quotes do not change the value) - - `"word" == "Word"` → `False` (capitalization matter when using `str`!!) - - `5 == "5"` → `False` (one is an `int`, the other a `str`) +Most math operators are very straightforward: +- `+` for addition +- `-` for subtraction +- `*` for multiplication +- `/` for division (note: always returns a `float` to allow decimals) +- `**` for exponentiation -- `!=`: returns `True` if values are **not** equal in value and `False` otherwise. The opposite of the previous operator. - - `5 != 5` → `False` - - `"word" != 'word'` → `False` - - `5 != "5"` → `True` - -- `>` / `<` / `>=` / `<=`: works the same as it does in math. Returns `True` if the equality is true, and `False` otherwise. - - `5 < 10` → `True` - - `2 > 5` → `False` - - `20 >= 20` → `True` - - `1 > 1` → `False` +Some examples: +``` +example_add = 20 + 32 +example_sub = 33 - 9 +example_mult = 10 * 7 +example_div = 200 / 5 +example_expo = 2 ** 8 +example_pemdas = (5 + 1) * (11 - 4) / 3 +```
-Write a function `function4(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. +Write a function `function4(num)` that takes an `int` called `num` as input, multiplies it by 3, adds 5, then returns it. For example: -- `function4(5)` → `False` -- `function4(11)` → `True` -- `function4(10)` → `True` +- `function4(5)` → `20` +- `function4(10)` → `35` +- `function4(0)` → `5` \ No newline at end of file diff --git a/level_0/function-4/io.json b/level_0/function-4/io.json index 2fb673e8..fd218452 100644 --- a/level_0/function-4/io.json +++ b/level_0/function-4/io.json @@ -1,22 +1,6 @@ [ { "input": [5], - "output": false - }, - { - "input": [11], - "output": true - }, - { - "input": [10], - "output": true - }, - { - "input": [100000], - "output": true - }, - { - "input": [-10], - "output": false + "output": 10 } ] \ No newline at end of file diff --git a/level_0/function-4/meta.json b/level_0/function-4/meta.json index 2e607553..f6b0f4bc 100644 --- a/level_0/function-4/meta.json +++ b/level_0/function-4/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Comparison Operators", + "title": "Functions: Math Operations 1", "name": "function4", "difficulty": "easy", "author": "", diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index 2dff0982..c5c0509f 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -1,54 +1,28 @@ -If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` keywords. - -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? - +If you want to compare multiple values to each other, you're going to need to know about some comparison operators. + +There are a couple ways to compare two values: +- `==`: returns `True` if the values are equal in value and `False` otherwise. + - `5 == 5` → `True` + - `"word" == 'word'` → `True` (the single VS double quotes do not change the value) + - `"word" == "Word"` → `False` (capitalization matter when using `str`!!) + - `5 == "5"` → `False` (one is an `int`, the other a `str`) + +- `!=`: returns `True` if values are **not** equal in value and `False` otherwise. The opposite of the previous operator. + - `5 != 5` → `False` + - `"word" != 'word'` → `False` + - `5 != "5"` → `True` + +- `>` / `<` / `>=` / `<=`: works the same as it does in math. Returns `True` if the equality is true, and `False` otherwise. + - `5 < 10` → `True` + - `2 > 5` → `False` + - `20 >= 20` → `True` + - `1 > 1` → `False`
-Write a function `function5(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. -The function takes as input and `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) +Write a function `function5(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. For example: -- `function5(18, True, False)` → `True` -- `function5(20, False, False)` → `False`, they don't have their ticket -- `function5(16, False, True)` → `True`, while underage and without ticket, they are a VIP +- `function4(5)` → `False` +- `function4(11)` → `True` +- `function4(10)` → `True` diff --git a/level_0/function-5/io.json b/level_0/function-5/io.json index b1bf83f8..2fb673e8 100644 --- a/level_0/function-5/io.json +++ b/level_0/function-5/io.json @@ -1,38 +1,22 @@ [ - { - "input": [18, true, false], - "output": true - }, - { - "input": [20, false, false], + { + "input": [5], "output": false }, - { - "input": [16, false, true], - "output": true - }, - { - "input": [25, true, false], - "output": true - }, - { - "input": [25, false, false], - "output": false + { + "input": [11], + "output": true }, - { - "input": [16, true, false], - "output": false + { + "input": [10], + "output": true }, - { - "input": [16, false, false], - "output": false + { + "input": [100000], + "output": true }, - { - "input": [16, true, true], - "output": true - }, - { - "input": [25, false, true], - "output": true + { + "input": [-10], + "output": false } ] \ No newline at end of file diff --git a/level_0/function-5/meta.json b/level_0/function-5/meta.json index 7c93e57a..b33f4f82 100644 --- a/level_0/function-5/meta.json +++ b/level_0/function-5/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Logical Operators", + "title": "Functions: Comparison Operators", "name": "function5", "difficulty": "easy", "author": "", diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md index 03aeb9a3..36e8fb61 100644 --- a/level_0/function-6/description.md +++ b/level_0/function-6/description.md @@ -1,43 +1,54 @@ -If you want to use conditions in your code, you're going to need the conditional statements `if`, `elif` and `else`. +If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` keywords. -`if` statements are formatted like this: -``` -if condition: - # do things -# do this afterwards, regardless of result -``` +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: ``` -if num > 10: - comment = "number greater than 10" -return comment +True and False → False +True or False → True +not True → False ``` -`if` statements can be paired with an `else` statement. As you might guess, the contents of `else` run when the `if` condition is `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`. -`else` statements are formatted like this: +Example: ``` -if num >= 10: - comment = "num is 10 or greater" -else: - comment = "num is less than 10" -return comment +a = True +b = True +c = False ``` -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`. -Example: ``` -if num >= 10: - comment = "num is 10 or greater" -elif num <= 5: # only checks this is num < 10 - comment = "num is 5 or less" -else: - comment = "num is between 6 and 9" -return comment +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? +
-Write a function `function6(bool1, bool2)` that takes two booleans as input. If `bool1` is `True` it should return `1`, otherwise if `bool2` is `True` it should return `2`, else return `0`. +Write a function `function6(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. +The function takes as input and `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: +- `function6(18, True, False)` → `True` +- `function6(20, False, False)` → `False`, they don't have their ticket +- `function6(16, False, True)` → `True`, while underage and without ticket, they are a VIP diff --git a/level_0/function-6/io.json b/level_0/function-6/io.json index 6a0b4716..b1bf83f8 100644 --- a/level_0/function-6/io.json +++ b/level_0/function-6/io.json @@ -1,18 +1,38 @@ [ - { - "input": [true, false], - "output": 1 + { + "input": [18, true, false], + "output": true }, - { - "input": [false, true], - "output": 2 + { + "input": [20, false, false], + "output": false }, - { - "input": [true, true], - "output": 1 + { + "input": [16, false, true], + "output": true }, - { - "input": [false, false], - "output": 0 + { + "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 } ] \ No newline at end of file diff --git a/level_0/function-6/meta.json b/level_0/function-6/meta.json index 8cb528d0..976ce9e1 100644 --- a/level_0/function-6/meta.json +++ b/level_0/function-6/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: If, Elif, and Else", + "title": "Functions: Logical Operators", "name": "function6", "difficulty": "easy", "author": "", diff --git a/level_0/function-7/description.md b/level_0/function-7/description.md new file mode 100644 index 00000000..8cb6f31d --- /dev/null +++ b/level_0/function-7/description.md @@ -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 +``` + +
+ +Write a function `function7(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: +- `function7(True, False)` → `1` +- `function7(False, True)` → `2` +- `function7(False, False)` → `0` diff --git a/level_0/function-7/io.json b/level_0/function-7/io.json new file mode 100644 index 00000000..6a0b4716 --- /dev/null +++ b/level_0/function-7/io.json @@ -0,0 +1,18 @@ +[ + { + "input": [true, false], + "output": 1 + }, + { + "input": [false, true], + "output": 2 + }, + { + "input": [true, true], + "output": 1 + }, + { + "input": [false, false], + "output": 0 + } +] \ No newline at end of file diff --git a/level_0/function-7/meta.json b/level_0/function-7/meta.json new file mode 100644 index 00000000..0813f8be --- /dev/null +++ b/level_0/function-7/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: If, Elif, and Else", + "name": "function7", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-7/starter.py b/level_0/function-7/starter.py new file mode 100644 index 00000000..e69de29b From 36de75fd4948a76b5bad4246cbc973fc986b1ea8 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 11:07:13 -0400 Subject: [PATCH 16/26] Fix incorrect function name in function-5 --- level_0/function-5/description.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index c5c0509f..cc46dd7c 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -23,6 +23,6 @@ There are a couple ways to compare two values: Write a function `function5(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. For example: -- `function4(5)` → `False` -- `function4(11)` → `True` -- `function4(10)` → `True` +- `function5(5)` → `False` +- `function5(11)` → `True` +- `function5(10)` → `True` From 298ebc1e59271db477519021c771f9ee8f583773 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 11:36:58 -0400 Subject: [PATCH 17/26] Create Functions: Math Operators 2 --- level_0/function-5/description.md | 34 +++++--------- level_0/function-5/io.json | 24 +++++----- level_0/function-5/meta.json | 4 +- level_0/function-6/description.md | 72 ++++++++++-------------------- level_0/function-6/io.json | 44 ++++++------------- level_0/function-6/meta.json | 2 +- level_0/function-7/description.md | 73 ++++++++++++++++--------------- level_0/function-7/io.json | 44 ++++++++++++++----- level_0/function-7/meta.json | 2 +- level_0/function-8/description.md | 53 ++++++++++++++++++++++ level_0/function-8/io.json | 18 ++++++++ level_0/function-8/meta.json | 10 +++++ level_0/function-8/starter.py | 0 13 files changed, 217 insertions(+), 163 deletions(-) create mode 100644 level_0/function-8/description.md create mode 100644 level_0/function-8/io.json create mode 100644 level_0/function-8/meta.json create mode 100644 level_0/function-8/starter.py diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index cc46dd7c..aad309de 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -1,28 +1,18 @@ -If you want to compare multiple values to each other, you're going to need to know about some comparison operators. +A very useful math operator to know about in coding is `%`, the Modulus Operator. -There are a couple ways to compare two values: -- `==`: returns `True` if the values are equal in value and `False` otherwise. - - `5 == 5` → `True` - - `"word" == 'word'` → `True` (the single VS double quotes do not change the value) - - `"word" == "Word"` → `False` (capitalization matter when using `str`!!) - - `5 == "5"` → `False` (one is an `int`, the other a `str`) - -- `!=`: returns `True` if values are **not** equal in value and `False` otherwise. The opposite of the previous operator. - - `5 != 5` → `False` - - `"word" != 'word'` → `False` - - `5 != "5"` → `True` - -- `>` / `<` / `>=` / `<=`: works the same as it does in math. Returns `True` if the equality is true, and `False` otherwise. - - `5 < 10` → `True` - - `2 > 5` → `False` - - `20 >= 20` → `True` - - `1 > 1` → `False` +Also called the remainder operator, it is used to get the remainder of the division of two `int`s. It can be used just like any other math operator. +Example: +``` +10 % 5 = 0 (10 divides cleanly by 5 with no remainder, so 0) +7 % 3 = 1 (7 can be divided into 2 groups of 3, leaving a remainder of 1) +6 % 10 = 6 (6 can't make one full group of 10, leaving a remainder of the whole 6) +```
-Write a function `function5(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. +For this problem, you are a baker who bakes doughnuts. You ship them in boxes of 12. Write a function `function5(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. For example: -- `function5(5)` → `False` -- `function5(11)` → `True` -- `function5(10)` → `True` +- `function5(48)` → `0` (48 goes cleanly into dozens, 0 remaining) +- `function5(13)` → `1` (13 makes one dozen, with 1 remaining) +- `function5(5)` → `5` (5 doesn't fill a dozen, so 5 remaining) \ No newline at end of file diff --git a/level_0/function-5/io.json b/level_0/function-5/io.json index 2fb673e8..1169503d 100644 --- a/level_0/function-5/io.json +++ b/level_0/function-5/io.json @@ -1,22 +1,26 @@ [ { - "input": [5], - "output": false + "input": [48], + "output": 0 + }, + { + "input": [13], + "output": 1 }, { - "input": [11], - "output": true + "input": [5], + "output": 5 }, { - "input": [10], - "output": true + "input": [12], + "output": 0 }, { - "input": [100000], - "output": true + "input": [128], + "output": 8 }, { - "input": [-10], - "output": false + "input": [0], + "output": 0 } ] \ No newline at end of file diff --git a/level_0/function-5/meta.json b/level_0/function-5/meta.json index b33f4f82..38a9515f 100644 --- a/level_0/function-5/meta.json +++ b/level_0/function-5/meta.json @@ -1,7 +1,7 @@ { - "title": "Functions: Comparison Operators", + "title": "Functions: Math Operators 2", "name": "function5", - "difficulty": "easy", + "difficulty": "medium", "author": "", "category": "Level 0", "question_type": [ diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md index 36e8fb61..f6a08ff2 100644 --- a/level_0/function-6/description.md +++ b/level_0/function-6/description.md @@ -1,54 +1,28 @@ -If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` keywords. - -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? - +If you want to compare multiple values to each other, you're going to need to know about some comparison operators. + +There are a couple ways to compare two values: +- `==`: returns `True` if the values are equal in value and `False` otherwise. + - `5 == 5` → `True` + - `"word" == 'word'` → `True` (the single VS double quotes do not change the value) + - `"word" == "Word"` → `False` (capitalization matter when using `str`!!) + - `5 == "5"` → `False` (one is an `int`, the other a `str`) + +- `!=`: returns `True` if values are **not** equal in value and `False` otherwise. The opposite of the previous operator. + - `5 != 5` → `False` + - `"word" != 'word'` → `False` + - `5 != "5"` → `True` + +- `>` / `<` / `>=` / `<=`: works the same as it does in math. Returns `True` if the equality is true, and `False` otherwise. + - `5 < 10` → `True` + - `2 > 5` → `False` + - `20 >= 20` → `True` + - `1 > 1` → `False`
-Write a function `function6(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. -The function takes as input and `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) +Write a function `function6(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. For example: -- `function6(18, True, False)` → `True` -- `function6(20, False, False)` → `False`, they don't have their ticket -- `function6(16, False, True)` → `True`, while underage and without ticket, they are a VIP +- `function6(5)` → `False` +- `function6(11)` → `True` +- `function6(10)` → `True` diff --git a/level_0/function-6/io.json b/level_0/function-6/io.json index b1bf83f8..2fb673e8 100644 --- a/level_0/function-6/io.json +++ b/level_0/function-6/io.json @@ -1,38 +1,22 @@ [ - { - "input": [18, true, false], - "output": true - }, - { - "input": [20, false, false], + { + "input": [5], "output": false }, - { - "input": [16, false, true], - "output": true - }, - { - "input": [25, true, false], - "output": true - }, - { - "input": [25, false, false], - "output": false + { + "input": [11], + "output": true }, - { - "input": [16, true, false], - "output": false + { + "input": [10], + "output": true }, - { - "input": [16, false, false], - "output": false + { + "input": [100000], + "output": true }, - { - "input": [16, true, true], - "output": true - }, - { - "input": [25, false, true], - "output": true + { + "input": [-10], + "output": false } ] \ No newline at end of file diff --git a/level_0/function-6/meta.json b/level_0/function-6/meta.json index 976ce9e1..043aaf7f 100644 --- a/level_0/function-6/meta.json +++ b/level_0/function-6/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Logical Operators", + "title": "Functions: Comparison Operators", "name": "function6", "difficulty": "easy", "author": "", diff --git a/level_0/function-7/description.md b/level_0/function-7/description.md index 8cb6f31d..0207f567 100644 --- a/level_0/function-7/description.md +++ b/level_0/function-7/description.md @@ -1,53 +1,54 @@ -If you want to use conditions in your code, you're going to need the conditional statements `if`, `elif` and `else`. +If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` keywords. -`if` statements are formatted like this: -``` -if condition: - # do things if condition == True -# do this afterwards, regardless of result -``` +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: ``` -note = "" -if num > 10: - note = "number greater than 10" -return note +True and False → False +True or False → True +not True → False ``` -`if` statements can be paired with an `else` statement. As you might guess, the contents of `else` run when the `if` condition is `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`. -`else` statements are formatted like this: +Example: ``` -note = "" -if num >= 10: - note = "num is 10 or greater" -else: - note = "num is less than 10" -return note +a = True +b = True +c = False ``` -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 +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? +
-Write a function `function7(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`. +Write a function `function7(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. +The function takes as input and `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) -Some examples: -- `function7(True, False)` → `1` -- `function7(False, True)` → `2` -- `function7(False, False)` → `0` +For example: +- `function7(18, True, False)` → `True` +- `function7(20, False, False)` → `False`, they don't have their ticket +- `function7(16, False, True)` → `True`, while underage and without ticket, they are a VIP diff --git a/level_0/function-7/io.json b/level_0/function-7/io.json index 6a0b4716..b1bf83f8 100644 --- a/level_0/function-7/io.json +++ b/level_0/function-7/io.json @@ -1,18 +1,38 @@ [ - { - "input": [true, false], - "output": 1 + { + "input": [18, true, false], + "output": true }, - { - "input": [false, true], - "output": 2 + { + "input": [20, false, false], + "output": false }, - { - "input": [true, true], - "output": 1 + { + "input": [16, false, true], + "output": true }, - { - "input": [false, false], - "output": 0 + { + "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 } ] \ No newline at end of file diff --git a/level_0/function-7/meta.json b/level_0/function-7/meta.json index 0813f8be..d81e2f7b 100644 --- a/level_0/function-7/meta.json +++ b/level_0/function-7/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: If, Elif, and Else", + "title": "Functions: Logical Operators", "name": "function7", "difficulty": "easy", "author": "", diff --git a/level_0/function-8/description.md b/level_0/function-8/description.md new file mode 100644 index 00000000..d690529d --- /dev/null +++ b/level_0/function-8/description.md @@ -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 +``` + +
+ +Write a function `function8(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: +- `function8(True, False)` → `1` +- `function8(False, True)` → `2` +- `function8(False, False)` → `0` diff --git a/level_0/function-8/io.json b/level_0/function-8/io.json new file mode 100644 index 00000000..6a0b4716 --- /dev/null +++ b/level_0/function-8/io.json @@ -0,0 +1,18 @@ +[ + { + "input": [true, false], + "output": 1 + }, + { + "input": [false, true], + "output": 2 + }, + { + "input": [true, true], + "output": 1 + }, + { + "input": [false, false], + "output": 0 + } +] \ No newline at end of file diff --git a/level_0/function-8/meta.json b/level_0/function-8/meta.json new file mode 100644 index 00000000..0a0a1f33 --- /dev/null +++ b/level_0/function-8/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Functions: If, Elif, and Else", + "name": "function8", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/function-8/starter.py b/level_0/function-8/starter.py new file mode 100644 index 00000000..e69de29b From fa188030404d43b4404b929fabdda579e5f477bb Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 12:14:04 -0400 Subject: [PATCH 18/26] Tweak phrasing and rename some problems less related to functions to not have Functions in the title --- level_0/function-1/description.md | 12 ++++++++++-- level_0/function-2/description.md | 28 ++++++++++++++++++---------- level_0/function-3/description.md | 21 ++++++++++++++------- level_0/function-3/meta.json | 4 ++-- level_0/function-3/starter.py | 2 +- level_0/function-4/io.json | 18 +++++++++++++++++- level_0/function-4/meta.json | 2 +- level_0/function-5/description.md | 6 +++++- level_0/function-5/meta.json | 2 +- level_0/function-6/meta.json | 2 +- level_0/function-7/description.md | 2 +- level_0/function-7/meta.json | 2 +- level_0/function-8/meta.json | 2 +- 13 files changed, 73 insertions(+), 30 deletions(-) diff --git a/level_0/function-1/description.md b/level_0/function-1/description.md index a554b0f5..013c9ed2 100644 --- a/level_0/function-1/description.md +++ b/level_0/function-1/description.md @@ -1,4 +1,6 @@ -To define a new function in Python, write `def function_name():` in the code box below. Don't forget the colon! +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. Any lines after the definition needs to be indented. You can indent with the Tab key. @@ -14,4 +16,10 @@ Note: if you want to write notes for yourself in the code, you can add comments Define a function called `function1()` that always returns `True`. -For the moment, all the function should contain is `return True`. We'll cover `return` statements in the next problem. \ No newline at end of file +It should look like this: +``` +def function1(): + return True +``` + +Then hit the "Run" button below, or hit Alt + Enter! diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md index 26bd29eb..3e7c3a74 100644 --- a/level_0/function-2/description.md +++ b/level_0/function-2/description.md @@ -1,14 +1,22 @@ -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. +Parameters -For any function you write, you can call the parameters whatever you want, `num1` and `num2` are just suggestions. +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. -Example: +For example, if you defined a function called `function2` with two parameters like this: +``` +def function2(num1, num2): + # do stuff +``` -`function2(10, 25)` -* This is calling function2 with 10 and 25 -* In this execution, `num1` = 10 and `num2` = 25 +If you were to run `function2(10, 25)`: +- This is calling `function2` with 10 and 25 +- In this execution, `num1` = 10 and `num2` = 25 + +
-`return` statements are how you get things out of functions. Coding Cat takes the function you write and passes a set list of inputs, and checks the expected result against what your code returns. +Return Statements + +`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: ``` @@ -23,8 +31,6 @@ You can create your own variables like I did with `diff` here, simply give it a 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! -Try writing `print(num1)` in your `function2` and see what happens! -
Write a function `function2(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum. @@ -32,4 +38,6 @@ Write a function `function2(num1, num2)` that takes in 2 numbers, `num1` and `nu For example: - `function2(10, 25)` → `35` - `function2(1, 1)` → `2` -- `function2(-5, -5)` → `-10` \ No newline at end of file +- `function2(-5, -5)` → `-10` + +Note: Try writing `print(num1)` in your `function2` and see what happens! diff --git a/level_0/function-3/description.md b/level_0/function-3/description.md index 0c30d73a..bbb9ab48 100644 --- a/level_0/function-3/description.md +++ b/level_0/function-3/description.md @@ -15,14 +15,21 @@ In Python, there are many data types, but the most common ones you'll see on Cod 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)`. +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. -Have a look at the starter code. *Don't worry about `__name__`, it will not come up in later problems.* This function will return a `str` representing the type of the variable `number`. **It currently does not use `var`.** +Example: +``` +x = 5 +y = "hello" +z = False +``` -For example: -`num = 5, word = "hello", no = False` -- `type(num).__name__ → 'int'` -- `type(word).__name__ → 'str'` -- `type(no).__name__ → 'bool'` +- `type(x).__name__` → `'int'` +- `type(y).__name__` → `'str'` +- `type(z).__name__` → `'bool'` +
+Have a look at the starter code. When you hit run, the function will be passed different types of variables. We want it to return each variable's type. + +**It currently only returns the type of the variable `number`, we want it to use `var`. Do not change `__name__`.** diff --git a/level_0/function-3/meta.json b/level_0/function-3/meta.json index e21162e2..77bc1eab 100644 --- a/level_0/function-3/meta.json +++ b/level_0/function-3/meta.json @@ -1,6 +1,6 @@ { - "title": "Functions: Types", - "name": "function3", + "title": "Basic Data Types", + "name": "get_var_type", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-3/starter.py b/level_0/function-3/starter.py index 243b37d3..698b020d 100644 --- a/level_0/function-3/starter.py +++ b/level_0/function-3/starter.py @@ -1,3 +1,3 @@ -def function3(var): +def get_var_type(var): number = 5 return type(number).__name__ \ No newline at end of file diff --git a/level_0/function-4/io.json b/level_0/function-4/io.json index fd218452..c45b1862 100644 --- a/level_0/function-4/io.json +++ b/level_0/function-4/io.json @@ -1,6 +1,22 @@ [ { "input": [5], - "output": 10 + "output": 20 + }, + { + "input": [10], + "output": 35 + }, + { + "input": [0], + "output": 5 + }, + { + "input": [100], + "output": 305 + }, + { + "input": [-5], + "output": -10 } ] \ No newline at end of file diff --git a/level_0/function-4/meta.json b/level_0/function-4/meta.json index f6b0f4bc..37672f1c 100644 --- a/level_0/function-4/meta.json +++ b/level_0/function-4/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Math Operations 1", + "title": "Math Operators 1", "name": "function4", "difficulty": "easy", "author": "", diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index aad309de..b981c006 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -8,9 +8,13 @@ Example: 6 % 10 = 6 (6 can't make one full group of 10, leaving a remainder of the whole 6) ``` +For more information on Modulus, check out [this blog post]() +
-For this problem, you are a baker who bakes doughnuts. You ship them in boxes of 12. Write a function `function5(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. +For this problem, you are a baker who bakes doughnuts. You ship them in boxes of 12. + +Write a function `function5(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. For example: - `function5(48)` → `0` (48 goes cleanly into dozens, 0 remaining) diff --git a/level_0/function-5/meta.json b/level_0/function-5/meta.json index 38a9515f..04b15183 100644 --- a/level_0/function-5/meta.json +++ b/level_0/function-5/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Math Operators 2", + "title": "Math Operators 2", "name": "function5", "difficulty": "medium", "author": "", diff --git a/level_0/function-6/meta.json b/level_0/function-6/meta.json index 043aaf7f..2ed41571 100644 --- a/level_0/function-6/meta.json +++ b/level_0/function-6/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Comparison Operators", + "title": "Comparison Operators", "name": "function6", "difficulty": "easy", "author": "", diff --git a/level_0/function-7/description.md b/level_0/function-7/description.md index 0207f567..ff48df9a 100644 --- a/level_0/function-7/description.md +++ b/level_0/function-7/description.md @@ -1,4 +1,4 @@ -If you want to combine and compare multiple conditions together, you're going to need the `and` and `or` keywords. +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` diff --git a/level_0/function-7/meta.json b/level_0/function-7/meta.json index d81e2f7b..13099e6d 100644 --- a/level_0/function-7/meta.json +++ b/level_0/function-7/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Logical Operators", + "title": "Logical Operators", "name": "function7", "difficulty": "easy", "author": "", diff --git a/level_0/function-8/meta.json b/level_0/function-8/meta.json index 0a0a1f33..66ef5c7c 100644 --- a/level_0/function-8/meta.json +++ b/level_0/function-8/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: If, Elif, and Else", + "title": "If, Elif, and Else Statements", "name": "function8", "difficulty": "easy", "author": "", From af54de8869a22103bf9365ed98e04f2fa79fbfd0 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 12:29:13 -0400 Subject: [PATCH 19/26] Change function names to be more relevant as I'm going to hardcode the problem order for level0 --- level_0/function-1/description.md | 6 +++--- level_0/function-1/meta.json | 2 +- level_0/function-2/description.md | 10 +++++----- level_0/function-2/meta.json | 2 +- level_0/function-3/description.md | 4 ++-- level_0/function-4/description.md | 8 ++++---- level_0/function-4/meta.json | 2 +- level_0/function-5/description.md | 8 ++++---- level_0/function-5/meta.json | 2 +- level_0/function-6/description.md | 8 ++++---- level_0/function-6/meta.json | 2 +- level_0/function-7/description.md | 8 ++++---- level_0/function-7/meta.json | 2 +- level_0/function-8/description.md | 8 ++++---- level_0/function-8/meta.json | 2 +- 15 files changed, 37 insertions(+), 37 deletions(-) diff --git a/level_0/function-1/description.md b/level_0/function-1/description.md index 013c9ed2..b444f837 100644 --- a/level_0/function-1/description.md +++ b/level_0/function-1/description.md @@ -10,15 +10,15 @@ 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 running code. +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.
-Define a function called `function1()` that always returns `True`. +Define a function called `return_true()` that always returns `True`. It should look like this: ``` -def function1(): +def return_true(): return True ``` diff --git a/level_0/function-1/meta.json b/level_0/function-1/meta.json index e1d64a08..0b48abe0 100644 --- a/level_0/function-1/meta.json +++ b/level_0/function-1/meta.json @@ -1,6 +1,6 @@ { "title": "Functions: Definition", - "name": "function1", + "name": "return_true", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-2/description.md b/level_0/function-2/description.md index 3e7c3a74..82acf715 100644 --- a/level_0/function-2/description.md +++ b/level_0/function-2/description.md @@ -33,11 +33,11 @@ If you aren't sure how your code is running, `print` statements can help you fig
-Write a function `function2(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum. +Write a function `sum_nums(num1, num2)` that takes in 2 numbers, `num1` and `num2` and returns their sum. For example: -- `function2(10, 25)` → `35` -- `function2(1, 1)` → `2` -- `function2(-5, -5)` → `-10` +- `sum_nums(10, 25)` → `35` +- `sum_nums(1, 1)` → `2` +- `sum_nums(-5, -5)` → `-10` -Note: Try writing `print(num1)` in your `function2` and see what happens! +Note: Try writing `print(num1)` in your `sum_nums` and see what happens! diff --git a/level_0/function-2/meta.json b/level_0/function-2/meta.json index caf91ec8..89889b91 100644 --- a/level_0/function-2/meta.json +++ b/level_0/function-2/meta.json @@ -1,6 +1,6 @@ { "title": "Functions: Parameters and Returns", - "name": "function2", + "name": "sum_nums", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-3/description.md b/level_0/function-3/description.md index bbb9ab48..873f1696 100644 --- a/level_0/function-3/description.md +++ b/level_0/function-3/description.md @@ -30,6 +30,6 @@ z = False
-Have a look at the starter code. When you hit run, the function will be passed different types of variables. We want it to return each variable's type. +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 change `__name__`.** +**It currently only returns the type of the variable `number`, we want it to use `var`. Do not touch `__name__`.** diff --git a/level_0/function-4/description.md b/level_0/function-4/description.md index d7a4fc65..b343f8c3 100644 --- a/level_0/function-4/description.md +++ b/level_0/function-4/description.md @@ -19,9 +19,9 @@ example_pemdas = (5 + 1) * (11 - 4) / 3
-Write a function `function4(num)` that takes an `int` called `num` as input, multiplies it by 3, adds 5, then returns it. +Write a function `plus_five_times_three(num)` that takes an `int` called `num` as input, adds 5, multiplies it by 3, then returns it. For example: -- `function4(5)` → `20` -- `function4(10)` → `35` -- `function4(0)` → `5` \ No newline at end of file +- `plus_five_times_three(5)` → `24` +- `plus_five_times_three(10)` → `39` +- `plus_five_times_three(0)` → `15` \ No newline at end of file diff --git a/level_0/function-4/meta.json b/level_0/function-4/meta.json index 37672f1c..e908bad2 100644 --- a/level_0/function-4/meta.json +++ b/level_0/function-4/meta.json @@ -1,6 +1,6 @@ { "title": "Math Operators 1", - "name": "function4", + "name": "plus_five_times_three", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-5/description.md b/level_0/function-5/description.md index b981c006..266ff1d3 100644 --- a/level_0/function-5/description.md +++ b/level_0/function-5/description.md @@ -14,9 +14,9 @@ For more information on Modulus, check out [this blog post]() For this problem, you are a baker who bakes doughnuts. You ship them in boxes of 12. -Write a function `function5(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. +Write a function `get_remaning_doughnuts(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. For example: -- `function5(48)` → `0` (48 goes cleanly into dozens, 0 remaining) -- `function5(13)` → `1` (13 makes one dozen, with 1 remaining) -- `function5(5)` → `5` (5 doesn't fill a dozen, so 5 remaining) \ No newline at end of file +- `get_remaning_doughnuts(48)` → `0` (48 goes cleanly into dozens, 0 remaining) +- `get_remaning_doughnuts(13)` → `1` (13 makes one dozen, with 1 remaining) +- `get_remaning_doughnuts(5)` → `5` (5 doesn't fill a dozen, so 5 remaining) \ No newline at end of file diff --git a/level_0/function-5/meta.json b/level_0/function-5/meta.json index 04b15183..b1126900 100644 --- a/level_0/function-5/meta.json +++ b/level_0/function-5/meta.json @@ -1,6 +1,6 @@ { "title": "Math Operators 2", - "name": "function5", + "name": "get_remaning_doughnuts", "difficulty": "medium", "author": "", "category": "Level 0", diff --git a/level_0/function-6/description.md b/level_0/function-6/description.md index f6a08ff2..c62e7fe6 100644 --- a/level_0/function-6/description.md +++ b/level_0/function-6/description.md @@ -20,9 +20,9 @@ There are a couple ways to compare two values:
-Write a function `function6(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. +Write a function `ten_or_greater(num)` that takes as input an `int` and returns `True` if `num` is greater than or equal to 10, and `False` otherwise. For example: -- `function6(5)` → `False` -- `function6(11)` → `True` -- `function6(10)` → `True` +- `ten_or_greater(5)` → `False` +- `ten_or_greater(11)` → `True` +- `ten_or_greater(10)` → `True` diff --git a/level_0/function-6/meta.json b/level_0/function-6/meta.json index 2ed41571..825ba403 100644 --- a/level_0/function-6/meta.json +++ b/level_0/function-6/meta.json @@ -1,6 +1,6 @@ { "title": "Comparison Operators", - "name": "function6", + "name": "greater_than_or_ten", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-7/description.md b/level_0/function-7/description.md index ff48df9a..51536213 100644 --- a/level_0/function-7/description.md +++ b/level_0/function-7/description.md @@ -42,13 +42,13 @@ See how the parentheses affects the order of operations?
-Write a function `function7(age, has_ticket, is_vip)` that returns `True` if a person can enter a venue, and `False` otherwise. +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 and `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: -- `function7(18, True, False)` → `True` -- `function7(20, False, False)` → `False`, they don't have their ticket -- `function7(16, False, True)` → `True`, while underage and without ticket, they are a VIP +- `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 diff --git a/level_0/function-7/meta.json b/level_0/function-7/meta.json index 13099e6d..82628fd8 100644 --- a/level_0/function-7/meta.json +++ b/level_0/function-7/meta.json @@ -1,6 +1,6 @@ { "title": "Logical Operators", - "name": "function7", + "name": "check_venue_access", "difficulty": "easy", "author": "", "category": "Level 0", diff --git a/level_0/function-8/description.md b/level_0/function-8/description.md index d690529d..960981ef 100644 --- a/level_0/function-8/description.md +++ b/level_0/function-8/description.md @@ -45,9 +45,9 @@ return note
-Write a function `function8(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`. +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: -- `function8(True, False)` → `1` -- `function8(False, True)` → `2` -- `function8(False, False)` → `0` +- `if_elif_else(True, False)` → `1` +- `if_elif_else(False, True)` → `2` +- `if_elif_else(False, False)` → `0` diff --git a/level_0/function-8/meta.json b/level_0/function-8/meta.json index 66ef5c7c..6ae12be1 100644 --- a/level_0/function-8/meta.json +++ b/level_0/function-8/meta.json @@ -1,6 +1,6 @@ { "title": "If, Elif, and Else Statements", - "name": "function8", + "name": "if_elif_else", "difficulty": "easy", "author": "", "category": "Level 0", From d418036d528b23cb7f4e14cb63d528ca73e0d93a Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 12:31:59 -0400 Subject: [PATCH 20/26] Rename dirs to be easier to navigate --- level_0/{function-1 => 1-function-def}/description.md | 0 level_0/{function-1 => 1-function-def}/io.json | 0 level_0/{function-1 => 1-function-def}/meta.json | 0 level_0/{function-1 => 1-function-def}/starter.py | 0 level_0/{function-2 => 2-params-return}/description.md | 0 level_0/{function-2 => 2-params-return}/io.json | 0 level_0/{function-2 => 2-params-return}/meta.json | 0 level_0/{function-2 => 2-params-return}/starter.py | 0 level_0/{function-3 => 3-types}/description.md | 0 level_0/{function-3 => 3-types}/io.json | 0 level_0/{function-3 => 3-types}/meta.json | 0 level_0/{function-3 => 3-types}/starter.py | 0 level_0/{function-4 => 4-math-ops-1}/description.md | 0 level_0/{function-4 => 4-math-ops-1}/io.json | 0 level_0/{function-4 => 4-math-ops-1}/meta.json | 0 level_0/{function-4 => 4-math-ops-1}/starter.py | 0 level_0/{function-5 => 5-math-ops-2}/description.md | 0 level_0/{function-5 => 5-math-ops-2}/io.json | 0 level_0/{function-5 => 5-math-ops-2}/meta.json | 0 level_0/{function-5 => 5-math-ops-2}/starter.py | 0 level_0/{function-6 => 6-comparison-ops}/description.md | 0 level_0/{function-6 => 6-comparison-ops}/io.json | 0 level_0/{function-6 => 6-comparison-ops}/meta.json | 0 level_0/{function-6 => 6-comparison-ops}/starter.py | 0 level_0/{function-7 => 7-logical-ops}/description.md | 0 level_0/{function-7 => 7-logical-ops}/io.json | 0 level_0/{function-7 => 7-logical-ops}/meta.json | 0 level_0/{function-7 => 7-logical-ops}/starter.py | 0 level_0/{function-8 => 8-if-elif-else}/description.md | 0 level_0/{function-8 => 8-if-elif-else}/io.json | 0 level_0/{function-8 => 8-if-elif-else}/meta.json | 0 level_0/{function-8 => 8-if-elif-else}/starter.py | 0 32 files changed, 0 insertions(+), 0 deletions(-) rename level_0/{function-1 => 1-function-def}/description.md (100%) rename level_0/{function-1 => 1-function-def}/io.json (100%) rename level_0/{function-1 => 1-function-def}/meta.json (100%) rename level_0/{function-1 => 1-function-def}/starter.py (100%) rename level_0/{function-2 => 2-params-return}/description.md (100%) rename level_0/{function-2 => 2-params-return}/io.json (100%) rename level_0/{function-2 => 2-params-return}/meta.json (100%) rename level_0/{function-2 => 2-params-return}/starter.py (100%) rename level_0/{function-3 => 3-types}/description.md (100%) rename level_0/{function-3 => 3-types}/io.json (100%) rename level_0/{function-3 => 3-types}/meta.json (100%) rename level_0/{function-3 => 3-types}/starter.py (100%) rename level_0/{function-4 => 4-math-ops-1}/description.md (100%) rename level_0/{function-4 => 4-math-ops-1}/io.json (100%) rename level_0/{function-4 => 4-math-ops-1}/meta.json (100%) rename level_0/{function-4 => 4-math-ops-1}/starter.py (100%) rename level_0/{function-5 => 5-math-ops-2}/description.md (100%) rename level_0/{function-5 => 5-math-ops-2}/io.json (100%) rename level_0/{function-5 => 5-math-ops-2}/meta.json (100%) rename level_0/{function-5 => 5-math-ops-2}/starter.py (100%) rename level_0/{function-6 => 6-comparison-ops}/description.md (100%) rename level_0/{function-6 => 6-comparison-ops}/io.json (100%) rename level_0/{function-6 => 6-comparison-ops}/meta.json (100%) rename level_0/{function-6 => 6-comparison-ops}/starter.py (100%) rename level_0/{function-7 => 7-logical-ops}/description.md (100%) rename level_0/{function-7 => 7-logical-ops}/io.json (100%) rename level_0/{function-7 => 7-logical-ops}/meta.json (100%) rename level_0/{function-7 => 7-logical-ops}/starter.py (100%) rename level_0/{function-8 => 8-if-elif-else}/description.md (100%) rename level_0/{function-8 => 8-if-elif-else}/io.json (100%) rename level_0/{function-8 => 8-if-elif-else}/meta.json (100%) rename level_0/{function-8 => 8-if-elif-else}/starter.py (100%) diff --git a/level_0/function-1/description.md b/level_0/1-function-def/description.md similarity index 100% rename from level_0/function-1/description.md rename to level_0/1-function-def/description.md diff --git a/level_0/function-1/io.json b/level_0/1-function-def/io.json similarity index 100% rename from level_0/function-1/io.json rename to level_0/1-function-def/io.json diff --git a/level_0/function-1/meta.json b/level_0/1-function-def/meta.json similarity index 100% rename from level_0/function-1/meta.json rename to level_0/1-function-def/meta.json diff --git a/level_0/function-1/starter.py b/level_0/1-function-def/starter.py similarity index 100% rename from level_0/function-1/starter.py rename to level_0/1-function-def/starter.py diff --git a/level_0/function-2/description.md b/level_0/2-params-return/description.md similarity index 100% rename from level_0/function-2/description.md rename to level_0/2-params-return/description.md diff --git a/level_0/function-2/io.json b/level_0/2-params-return/io.json similarity index 100% rename from level_0/function-2/io.json rename to level_0/2-params-return/io.json diff --git a/level_0/function-2/meta.json b/level_0/2-params-return/meta.json similarity index 100% rename from level_0/function-2/meta.json rename to level_0/2-params-return/meta.json diff --git a/level_0/function-2/starter.py b/level_0/2-params-return/starter.py similarity index 100% rename from level_0/function-2/starter.py rename to level_0/2-params-return/starter.py diff --git a/level_0/function-3/description.md b/level_0/3-types/description.md similarity index 100% rename from level_0/function-3/description.md rename to level_0/3-types/description.md diff --git a/level_0/function-3/io.json b/level_0/3-types/io.json similarity index 100% rename from level_0/function-3/io.json rename to level_0/3-types/io.json diff --git a/level_0/function-3/meta.json b/level_0/3-types/meta.json similarity index 100% rename from level_0/function-3/meta.json rename to level_0/3-types/meta.json diff --git a/level_0/function-3/starter.py b/level_0/3-types/starter.py similarity index 100% rename from level_0/function-3/starter.py rename to level_0/3-types/starter.py diff --git a/level_0/function-4/description.md b/level_0/4-math-ops-1/description.md similarity index 100% rename from level_0/function-4/description.md rename to level_0/4-math-ops-1/description.md diff --git a/level_0/function-4/io.json b/level_0/4-math-ops-1/io.json similarity index 100% rename from level_0/function-4/io.json rename to level_0/4-math-ops-1/io.json diff --git a/level_0/function-4/meta.json b/level_0/4-math-ops-1/meta.json similarity index 100% rename from level_0/function-4/meta.json rename to level_0/4-math-ops-1/meta.json diff --git a/level_0/function-4/starter.py b/level_0/4-math-ops-1/starter.py similarity index 100% rename from level_0/function-4/starter.py rename to level_0/4-math-ops-1/starter.py diff --git a/level_0/function-5/description.md b/level_0/5-math-ops-2/description.md similarity index 100% rename from level_0/function-5/description.md rename to level_0/5-math-ops-2/description.md diff --git a/level_0/function-5/io.json b/level_0/5-math-ops-2/io.json similarity index 100% rename from level_0/function-5/io.json rename to level_0/5-math-ops-2/io.json diff --git a/level_0/function-5/meta.json b/level_0/5-math-ops-2/meta.json similarity index 100% rename from level_0/function-5/meta.json rename to level_0/5-math-ops-2/meta.json diff --git a/level_0/function-5/starter.py b/level_0/5-math-ops-2/starter.py similarity index 100% rename from level_0/function-5/starter.py rename to level_0/5-math-ops-2/starter.py diff --git a/level_0/function-6/description.md b/level_0/6-comparison-ops/description.md similarity index 100% rename from level_0/function-6/description.md rename to level_0/6-comparison-ops/description.md diff --git a/level_0/function-6/io.json b/level_0/6-comparison-ops/io.json similarity index 100% rename from level_0/function-6/io.json rename to level_0/6-comparison-ops/io.json diff --git a/level_0/function-6/meta.json b/level_0/6-comparison-ops/meta.json similarity index 100% rename from level_0/function-6/meta.json rename to level_0/6-comparison-ops/meta.json diff --git a/level_0/function-6/starter.py b/level_0/6-comparison-ops/starter.py similarity index 100% rename from level_0/function-6/starter.py rename to level_0/6-comparison-ops/starter.py diff --git a/level_0/function-7/description.md b/level_0/7-logical-ops/description.md similarity index 100% rename from level_0/function-7/description.md rename to level_0/7-logical-ops/description.md diff --git a/level_0/function-7/io.json b/level_0/7-logical-ops/io.json similarity index 100% rename from level_0/function-7/io.json rename to level_0/7-logical-ops/io.json diff --git a/level_0/function-7/meta.json b/level_0/7-logical-ops/meta.json similarity index 100% rename from level_0/function-7/meta.json rename to level_0/7-logical-ops/meta.json diff --git a/level_0/function-7/starter.py b/level_0/7-logical-ops/starter.py similarity index 100% rename from level_0/function-7/starter.py rename to level_0/7-logical-ops/starter.py diff --git a/level_0/function-8/description.md b/level_0/8-if-elif-else/description.md similarity index 100% rename from level_0/function-8/description.md rename to level_0/8-if-elif-else/description.md diff --git a/level_0/function-8/io.json b/level_0/8-if-elif-else/io.json similarity index 100% rename from level_0/function-8/io.json rename to level_0/8-if-elif-else/io.json diff --git a/level_0/function-8/meta.json b/level_0/8-if-elif-else/meta.json similarity index 100% rename from level_0/function-8/meta.json rename to level_0/8-if-elif-else/meta.json diff --git a/level_0/function-8/starter.py b/level_0/8-if-elif-else/starter.py similarity index 100% rename from level_0/function-8/starter.py rename to level_0/8-if-elif-else/starter.py From 48a25ae8d71e108fb9ff3d874b0aff378b33e6f7 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 12:32:59 -0400 Subject: [PATCH 21/26] Fix incorrect meta on 6-comparison-ops --- level_0/6-comparison-ops/meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/level_0/6-comparison-ops/meta.json b/level_0/6-comparison-ops/meta.json index 825ba403..9915f1b1 100644 --- a/level_0/6-comparison-ops/meta.json +++ b/level_0/6-comparison-ops/meta.json @@ -1,6 +1,6 @@ { "title": "Comparison Operators", - "name": "greater_than_or_ten", + "name": "ten_or_greater", "difficulty": "easy", "author": "", "category": "Level 0", From c894fdba82439d1c69170b3fa372b2c0cc286249 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 12:41:42 -0400 Subject: [PATCH 22/26] Fix typo in function name in get_remaining_doughnuts --- level_0/5-math-ops-2/description.md | 8 ++++---- level_0/5-math-ops-2/meta.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/level_0/5-math-ops-2/description.md b/level_0/5-math-ops-2/description.md index 266ff1d3..c6cb3591 100644 --- a/level_0/5-math-ops-2/description.md +++ b/level_0/5-math-ops-2/description.md @@ -14,9 +14,9 @@ For more information on Modulus, check out [this blog post]() For this problem, you are a baker who bakes doughnuts. You ship them in boxes of 12. -Write a function `get_remaning_doughnuts(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. +Write a function `get_remaining_doughnuts(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. For example: -- `get_remaning_doughnuts(48)` → `0` (48 goes cleanly into dozens, 0 remaining) -- `get_remaning_doughnuts(13)` → `1` (13 makes one dozen, with 1 remaining) -- `get_remaning_doughnuts(5)` → `5` (5 doesn't fill a dozen, so 5 remaining) \ No newline at end of file +- `get_remaining_doughnuts(48)` → `0` (48 goes cleanly into dozens, 0 remaining) +- `get_remaining_doughnuts(13)` → `1` (13 makes one dozen, with 1 remaining) +- `get_remaining_doughnuts(5)` → `5` (5 doesn't fill a dozen, so 5 remaining) \ No newline at end of file diff --git a/level_0/5-math-ops-2/meta.json b/level_0/5-math-ops-2/meta.json index b1126900..2bcf9088 100644 --- a/level_0/5-math-ops-2/meta.json +++ b/level_0/5-math-ops-2/meta.json @@ -1,6 +1,6 @@ { "title": "Math Operators 2", - "name": "get_remaning_doughnuts", + "name": "get_remaining_doughnuts", "difficulty": "medium", "author": "", "category": "Level 0", From 289574ccde57b4091d7f60ce26739da72343f673 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 12:43:50 -0400 Subject: [PATCH 23/26] Fix incorrect test suite in math-ops-1 --- level_0/4-math-ops-1/io.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/level_0/4-math-ops-1/io.json b/level_0/4-math-ops-1/io.json index c45b1862..78028216 100644 --- a/level_0/4-math-ops-1/io.json +++ b/level_0/4-math-ops-1/io.json @@ -1,22 +1,22 @@ [ { "input": [5], - "output": 20 + "output": 30 }, { "input": [10], - "output": 35 + "output": 45 }, { "input": [0], - "output": 5 + "output": 15 }, { "input": [100], - "output": 305 + "output": 315 }, { - "input": [-5], - "output": -10 + "input": [-10], + "output": -15 } ] \ No newline at end of file From c548b929e94267b879d2566b5027b3d09f61f41d Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Fri, 22 May 2026 14:34:36 -0400 Subject: [PATCH 24/26] Add numbers before each title in Level 0 --- level_0/1-function-def/meta.json | 2 +- level_0/2-params-return/meta.json | 2 +- level_0/3-types/meta.json | 2 +- level_0/4-math-ops-1/meta.json | 2 +- level_0/5-math-ops-2/meta.json | 2 +- level_0/6-comparison-ops/meta.json | 2 +- level_0/7-logical-ops/meta.json | 2 +- level_0/8-if-elif-else/meta.json | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/level_0/1-function-def/meta.json b/level_0/1-function-def/meta.json index 0b48abe0..dce2c149 100644 --- a/level_0/1-function-def/meta.json +++ b/level_0/1-function-def/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Definition", + "title": "1: Function Definition", "name": "return_true", "difficulty": "easy", "author": "", diff --git a/level_0/2-params-return/meta.json b/level_0/2-params-return/meta.json index 89889b91..471803be 100644 --- a/level_0/2-params-return/meta.json +++ b/level_0/2-params-return/meta.json @@ -1,5 +1,5 @@ { - "title": "Functions: Parameters and Returns", + "title": "2: Function Parameters and Returns", "name": "sum_nums", "difficulty": "easy", "author": "", diff --git a/level_0/3-types/meta.json b/level_0/3-types/meta.json index 77bc1eab..a0a36112 100644 --- a/level_0/3-types/meta.json +++ b/level_0/3-types/meta.json @@ -1,5 +1,5 @@ { - "title": "Basic Data Types", + "title": "3: Basic Data Types", "name": "get_var_type", "difficulty": "easy", "author": "", diff --git a/level_0/4-math-ops-1/meta.json b/level_0/4-math-ops-1/meta.json index e908bad2..c1ee11fd 100644 --- a/level_0/4-math-ops-1/meta.json +++ b/level_0/4-math-ops-1/meta.json @@ -1,5 +1,5 @@ { - "title": "Math Operators 1", + "title": "4: Math Operators 1", "name": "plus_five_times_three", "difficulty": "easy", "author": "", diff --git a/level_0/5-math-ops-2/meta.json b/level_0/5-math-ops-2/meta.json index 2bcf9088..0ebbab3d 100644 --- a/level_0/5-math-ops-2/meta.json +++ b/level_0/5-math-ops-2/meta.json @@ -1,5 +1,5 @@ { - "title": "Math Operators 2", + "title": "5: Math Operators 2", "name": "get_remaining_doughnuts", "difficulty": "medium", "author": "", diff --git a/level_0/6-comparison-ops/meta.json b/level_0/6-comparison-ops/meta.json index 9915f1b1..67c4371d 100644 --- a/level_0/6-comparison-ops/meta.json +++ b/level_0/6-comparison-ops/meta.json @@ -1,5 +1,5 @@ { - "title": "Comparison Operators", + "title": "6: Comparison Operators", "name": "ten_or_greater", "difficulty": "easy", "author": "", diff --git a/level_0/7-logical-ops/meta.json b/level_0/7-logical-ops/meta.json index 82628fd8..b23bdcf4 100644 --- a/level_0/7-logical-ops/meta.json +++ b/level_0/7-logical-ops/meta.json @@ -1,5 +1,5 @@ { - "title": "Logical Operators", + "title": "7: Logical Operators", "name": "check_venue_access", "difficulty": "easy", "author": "", diff --git a/level_0/8-if-elif-else/meta.json b/level_0/8-if-elif-else/meta.json index 6ae12be1..c272b92d 100644 --- a/level_0/8-if-elif-else/meta.json +++ b/level_0/8-if-elif-else/meta.json @@ -1,5 +1,5 @@ { - "title": "If, Elif, and Else Statements", + "title": "8: If, Elif, and Else Statements", "name": "if_elif_else", "difficulty": "easy", "author": "", From 26639174284e563dfcf6631eee8fb08ab8eafa24 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Tue, 26 May 2026 11:46:25 -0400 Subject: [PATCH 25/26] Create a bunch more problems and tweak existing ones --- level_0/1-function-def/description.md | 2 +- level_0/1-function-def/meta.json | 2 +- .../description.md | 6 +-- .../{7-logical-ops => 10-logical-ops}/io.json | 0 .../meta.json | 4 +- .../starter.py | 0 .../description.md | 0 .../io.json | 0 .../meta.json | 4 +- .../starter.py | 0 level_0/2-params-return/meta.json | 2 +- level_0/3-types/meta.json | 2 +- level_0/4-math-ops-1/description.md | 4 +- level_0/4-math-ops-1/meta.json | 2 +- level_0/5-math-ops-2/description.md | 6 +-- level_0/5-math-ops-2/meta.json | 2 +- level_0/6-string-concat-1/description.md | 33 +++++++++++++++ level_0/6-string-concat-1/io.json | 8 ++++ level_0/6-string-concat-1/meta.json | 10 +++++ .../starter.py | 0 level_0/7-string-concat-2/description.md | 20 +++++++++ level_0/7-string-concat-2/io.json | 22 ++++++++++ level_0/7-string-concat-2/meta.json | 10 +++++ level_0/7-string-concat-2/starter.py | 0 level_0/8-f-strings/description.md | 19 +++++++++ level_0/8-f-strings/io.json | 15 +++++++ level_0/8-f-strings/meta.json | 10 +++++ level_0/8-f-strings/starter.py | 0 .../description.md | 0 .../io.json | 0 .../meta.json | 4 +- level_0/9-comparison-ops/starter.py | 0 level_0/calculate-absolute/description.md | 8 ++++ level_0/calculate-absolute/io.json | 42 +++++++++++++++++++ level_0/calculate-absolute/meta.json | 10 +++++ level_0/calculate-absolute/starter.py | 0 level_0/is-even/description.md | 8 ++++ level_0/is-even/io.json | 42 +++++++++++++++++++ level_0/is-even/meta.json | 10 +++++ level_0/is-even/starter.py | 0 40 files changed, 288 insertions(+), 19 deletions(-) rename level_0/{7-logical-ops => 10-logical-ops}/description.md (84%) rename level_0/{7-logical-ops => 10-logical-ops}/io.json (100%) rename level_0/{7-logical-ops => 10-logical-ops}/meta.json (65%) rename level_0/{6-comparison-ops => 10-logical-ops}/starter.py (100%) rename level_0/{8-if-elif-else => 11-if-elif-else}/description.md (100%) rename level_0/{8-if-elif-else => 11-if-elif-else}/io.json (100%) rename level_0/{8-if-elif-else => 11-if-elif-else}/meta.json (60%) rename level_0/{7-logical-ops => 11-if-elif-else}/starter.py (100%) create mode 100644 level_0/6-string-concat-1/description.md create mode 100644 level_0/6-string-concat-1/io.json create mode 100644 level_0/6-string-concat-1/meta.json rename level_0/{8-if-elif-else => 6-string-concat-1}/starter.py (100%) create mode 100644 level_0/7-string-concat-2/description.md create mode 100644 level_0/7-string-concat-2/io.json create mode 100644 level_0/7-string-concat-2/meta.json create mode 100644 level_0/7-string-concat-2/starter.py create mode 100644 level_0/8-f-strings/description.md create mode 100644 level_0/8-f-strings/io.json create mode 100644 level_0/8-f-strings/meta.json create mode 100644 level_0/8-f-strings/starter.py rename level_0/{6-comparison-ops => 9-comparison-ops}/description.md (100%) rename level_0/{6-comparison-ops => 9-comparison-ops}/io.json (100%) rename level_0/{6-comparison-ops => 9-comparison-ops}/meta.json (64%) create mode 100644 level_0/9-comparison-ops/starter.py create mode 100644 level_0/calculate-absolute/description.md create mode 100644 level_0/calculate-absolute/io.json create mode 100644 level_0/calculate-absolute/meta.json create mode 100644 level_0/calculate-absolute/starter.py create mode 100644 level_0/is-even/description.md create mode 100644 level_0/is-even/io.json create mode 100644 level_0/is-even/meta.json create mode 100644 level_0/is-even/starter.py diff --git a/level_0/1-function-def/description.md b/level_0/1-function-def/description.md index b444f837..b8dc9491 100644 --- a/level_0/1-function-def/description.md +++ b/level_0/1-function-def/description.md @@ -1,6 +1,6 @@ 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. +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. diff --git a/level_0/1-function-def/meta.json b/level_0/1-function-def/meta.json index dce2c149..0eeb341a 100644 --- a/level_0/1-function-def/meta.json +++ b/level_0/1-function-def/meta.json @@ -2,7 +2,7 @@ "title": "1: Function Definition", "name": "return_true", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/7-logical-ops/description.md b/level_0/10-logical-ops/description.md similarity index 84% rename from level_0/7-logical-ops/description.md rename to level_0/10-logical-ops/description.md index 51536213..b223459b 100644 --- a/level_0/7-logical-ops/description.md +++ b/level_0/10-logical-ops/description.md @@ -43,10 +43,10 @@ See how the parentheses affects the order of operations?
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 and `int` for the person's `age`, and two `bool`s for whether they have their ticket and if they are a VIP. +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) +- 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` diff --git a/level_0/7-logical-ops/io.json b/level_0/10-logical-ops/io.json similarity index 100% rename from level_0/7-logical-ops/io.json rename to level_0/10-logical-ops/io.json diff --git a/level_0/7-logical-ops/meta.json b/level_0/10-logical-ops/meta.json similarity index 65% rename from level_0/7-logical-ops/meta.json rename to level_0/10-logical-ops/meta.json index b23bdcf4..32159747 100644 --- a/level_0/7-logical-ops/meta.json +++ b/level_0/10-logical-ops/meta.json @@ -1,8 +1,8 @@ { - "title": "7: Logical Operators", + "title": "10: Logical Operators", "name": "check_venue_access", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/6-comparison-ops/starter.py b/level_0/10-logical-ops/starter.py similarity index 100% rename from level_0/6-comparison-ops/starter.py rename to level_0/10-logical-ops/starter.py diff --git a/level_0/8-if-elif-else/description.md b/level_0/11-if-elif-else/description.md similarity index 100% rename from level_0/8-if-elif-else/description.md rename to level_0/11-if-elif-else/description.md diff --git a/level_0/8-if-elif-else/io.json b/level_0/11-if-elif-else/io.json similarity index 100% rename from level_0/8-if-elif-else/io.json rename to level_0/11-if-elif-else/io.json diff --git a/level_0/8-if-elif-else/meta.json b/level_0/11-if-elif-else/meta.json similarity index 60% rename from level_0/8-if-elif-else/meta.json rename to level_0/11-if-elif-else/meta.json index c272b92d..485d17bc 100644 --- a/level_0/8-if-elif-else/meta.json +++ b/level_0/11-if-elif-else/meta.json @@ -1,8 +1,8 @@ { - "title": "8: If, Elif, and Else Statements", + "title": "11: If, Elif, and Else Statements", "name": "if_elif_else", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/7-logical-ops/starter.py b/level_0/11-if-elif-else/starter.py similarity index 100% rename from level_0/7-logical-ops/starter.py rename to level_0/11-if-elif-else/starter.py diff --git a/level_0/2-params-return/meta.json b/level_0/2-params-return/meta.json index 471803be..000fa626 100644 --- a/level_0/2-params-return/meta.json +++ b/level_0/2-params-return/meta.json @@ -2,7 +2,7 @@ "title": "2: Function Parameters and Returns", "name": "sum_nums", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/3-types/meta.json b/level_0/3-types/meta.json index a0a36112..7ef31d3f 100644 --- a/level_0/3-types/meta.json +++ b/level_0/3-types/meta.json @@ -2,7 +2,7 @@ "title": "3: Basic Data Types", "name": "get_var_type", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/4-math-ops-1/description.md b/level_0/4-math-ops-1/description.md index b343f8c3..e9207010 100644 --- a/level_0/4-math-ops-1/description.md +++ b/level_0/4-math-ops-1/description.md @@ -24,4 +24,6 @@ Write a function `plus_five_times_three(num)` that takes an `int` called `num` a For example: - `plus_five_times_three(5)` → `24` - `plus_five_times_three(10)` → `39` -- `plus_five_times_three(0)` → `15` \ No newline at end of file +- `plus_five_times_three(0)` → `15` + +Remember the order of operations! diff --git a/level_0/4-math-ops-1/meta.json b/level_0/4-math-ops-1/meta.json index c1ee11fd..76f7ce0d 100644 --- a/level_0/4-math-ops-1/meta.json +++ b/level_0/4-math-ops-1/meta.json @@ -2,7 +2,7 @@ "title": "4: Math Operators 1", "name": "plus_five_times_three", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/5-math-ops-2/description.md b/level_0/5-math-ops-2/description.md index c6cb3591..21bec509 100644 --- a/level_0/5-math-ops-2/description.md +++ b/level_0/5-math-ops-2/description.md @@ -8,13 +8,13 @@ Example: 6 % 10 = 6 (6 can't make one full group of 10, leaving a remainder of the whole 6) ``` -For more information on Modulus, check out [this blog post]() +For more information on Modulus and other math operators, check out [this blog post](/#/blogs/math_operators).
-For this problem, you are a baker who bakes doughnuts. You ship them in boxes of 12. +Imagine you are a baker who makes doughnuts. You ship them in boxes of 12. -Write a function `get_remaining_doughnuts(doughtnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. +Write a function `get_remaining_doughnuts(doughnuts)` that takes an `int` representing a number of doughnuts, and returns an `int` representing the number of doughnuts remaining after you fill as many boxes of 12 as you can. For example: - `get_remaining_doughnuts(48)` → `0` (48 goes cleanly into dozens, 0 remaining) diff --git a/level_0/5-math-ops-2/meta.json b/level_0/5-math-ops-2/meta.json index 0ebbab3d..606e9179 100644 --- a/level_0/5-math-ops-2/meta.json +++ b/level_0/5-math-ops-2/meta.json @@ -2,7 +2,7 @@ "title": "5: Math Operators 2", "name": "get_remaining_doughnuts", "difficulty": "medium", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/6-string-concat-1/description.md b/level_0/6-string-concat-1/description.md new file mode 100644 index 00000000..c4951c2d --- /dev/null +++ b/level_0/6-string-concat-1/description.md @@ -0,0 +1,33 @@ +Strings share some operators with ints, `+`/`+=` for example. + +You can add strings to other strings or multiply them by ints as if you were doing math. This is called string concatenation. + +For example, say you needed to take two strings and return them as one combined string. +``` +string1 = "Hello" +string2 = "World" +combined = s1 + s2 + +print(combined) +``` + +This would print `"HelloWorld"`, which works but I want a space between them. This is easy! + +``` +string1 = "Hello" +string2 = "World" +combined = s1 + " " + s2 + +print(combined) +``` + +You can add as many strings together as you want! + +
+ +Write a function `add_exclamation(s)` that takes a string `s` as input returns the string with '`!`' prepended and appended (added before and after the string). + +For example: +- `add_exclamation("hey")` → `!hey!` +- `add_exclamation("wow")` → `!wow!` +- `add_exclamation("")` → `!!` \ No newline at end of file diff --git a/level_0/6-string-concat-1/io.json b/level_0/6-string-concat-1/io.json new file mode 100644 index 00000000..086f0b22 --- /dev/null +++ b/level_0/6-string-concat-1/io.json @@ -0,0 +1,8 @@ +[ + {"input": ["hey"], "output": "!hey!"}, + {"input": ["wow"], "output": "!wow!"}, + {"input": [""], "output": "!!"}, + {"input": ["!"], "output": "!!!"}, + {"input": ["_"], "output": "!_!"}, + {"input": ["hello world"], "output": "!hello world!"} +] diff --git a/level_0/6-string-concat-1/meta.json b/level_0/6-string-concat-1/meta.json new file mode 100644 index 00000000..91f1b1d5 --- /dev/null +++ b/level_0/6-string-concat-1/meta.json @@ -0,0 +1,10 @@ +{ + "title": "6: String Concatenation 1", + "name": "add_exclamation", + "difficulty": "easy", + "author": "Luke Weaver", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/8-if-elif-else/starter.py b/level_0/6-string-concat-1/starter.py similarity index 100% rename from level_0/8-if-elif-else/starter.py rename to level_0/6-string-concat-1/starter.py diff --git a/level_0/7-string-concat-2/description.md b/level_0/7-string-concat-2/description.md new file mode 100644 index 00000000..b71dd1d6 --- /dev/null +++ b/level_0/7-string-concat-2/description.md @@ -0,0 +1,20 @@ +Strings can also be multiplied by `int`s with `*`! + +Say you wanted to print 50 `#`s. Don't ask me why, you wanted to. One way you could accomplish this is to write `print("#")` 50 times, but that would be slow, annoying, and each `#` would be on its own line. + +This is where the multiplication comes in handy, you could simply write: +``` +pound = "#" +print(pound * 50) +``` + +Just like that, you have your 50 `#`s, for whatever you wanted them for. + +
+ +Write a function `str_mult(s, num)` that takes a `str` called `s` and an `int` called `num` as input. This function should return a `str` containing `s`, `num` times. + +For example: +- `str_mult("cat", 5)` → `"catcatcatcatcat"` +- `str_mult("gebfcsvfs", 1)` → `"gebfcsvfs"` +- `str_mult(0)` → `""` \ No newline at end of file diff --git a/level_0/7-string-concat-2/io.json b/level_0/7-string-concat-2/io.json new file mode 100644 index 00000000..e7b3e13c --- /dev/null +++ b/level_0/7-string-concat-2/io.json @@ -0,0 +1,22 @@ +[ + { + "input": ["cat", 5], + "output": "catcatcatcatcat" + }, + { + "input": ["gebfcsvfs", 1], + "output": "gebfcsvfs" + }, + { + "input": ["nothing", 0], + "output": "" + }, + { + "input": ["*", 10], + "output": "**********" + }, + { + "input": ["#", 50], + "output": "##################################################" + } +] \ No newline at end of file diff --git a/level_0/7-string-concat-2/meta.json b/level_0/7-string-concat-2/meta.json new file mode 100644 index 00000000..5ed44d56 --- /dev/null +++ b/level_0/7-string-concat-2/meta.json @@ -0,0 +1,10 @@ +{ + "title": "7: String Concatenation 2", + "name": "str_mult", + "difficulty": "easy", + "author": "Luke Weaver", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/7-string-concat-2/starter.py b/level_0/7-string-concat-2/starter.py new file mode 100644 index 00000000..e69de29b diff --git a/level_0/8-f-strings/description.md b/level_0/8-f-strings/description.md new file mode 100644 index 00000000..31c6f782 --- /dev/null +++ b/level_0/8-f-strings/description.md @@ -0,0 +1,19 @@ +There are more ways to construct strings than using concatenation. + +The simplest and most effective method for our purposes are F-strings. They allow you to put your variable names straight into a string definition and Python will insert the value for you when run! + +The "F" stands for "formatted", and is also how you create an f-string. First, define a `str` as usual, then put an `f` in front of the quotes, on the outside. To insert a value, wrap the variable name in `{}`. + +For example: +`x = 10, greeting = "Howdy", cost = 10.25` +- `f"x is equal to {x}."` → `"x is equal to 10."` +- `f"{greeting}!"` → `"Howdy!"` +- `f"Tickets cost ${cost}."` → `"Tickets cost $10.25."` + +
+ +Write a function `hello_greeting(name: str)` that takes a string `name` as input and returns a greeting of the form `"Hello Name!"`, where `Name` is the input string. + +For example: +- `hello_greeting("Bob")` → `"Hello Bob!"` +- `hello_greeting("Alice")` → `"Hello Alice!"` \ No newline at end of file diff --git a/level_0/8-f-strings/io.json b/level_0/8-f-strings/io.json new file mode 100644 index 00000000..6a9ca02f --- /dev/null +++ b/level_0/8-f-strings/io.json @@ -0,0 +1,15 @@ +[ + {"input": ["Bob"], "output": "Hello Bob!"}, + {"input": ["Alice"], "output": "Hello Alice!"}, + {"input": ["Eric"], "output": "Hello Eric!"}, + {"input": ["John Doe"], "output": "Hello John Doe!"}, + {"input": ["Jane Smith"], "output": "Hello Jane Smith!"}, + {"input": ["O'Neil"], "output": "Hello O'Neil!"}, + {"input": ["Li"], "output": "Hello Li!"}, + {"input": ["Anne-Marie"], "output": "Hello Anne-Marie!"}, + {"input": ["😊"], "output": "Hello 😊!"}, + {"input": ["123"], "output": "Hello 123!"}, + {"input": ["Dr. Robert"], "output": "Hello Dr. Robert!"}, + {"input": [" "], "output": "Hello !"}, + {"input": ["Jean-Luc"], "output": "Hello Jean-Luc!"} +] \ No newline at end of file diff --git a/level_0/8-f-strings/meta.json b/level_0/8-f-strings/meta.json new file mode 100644 index 00000000..45cb8acb --- /dev/null +++ b/level_0/8-f-strings/meta.json @@ -0,0 +1,10 @@ +{ + "title": "8: Formatted Strings", + "name": "hello_greeting", + "difficulty": "easy", + "author": "Luke Weaver", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/8-f-strings/starter.py b/level_0/8-f-strings/starter.py new file mode 100644 index 00000000..e69de29b diff --git a/level_0/6-comparison-ops/description.md b/level_0/9-comparison-ops/description.md similarity index 100% rename from level_0/6-comparison-ops/description.md rename to level_0/9-comparison-ops/description.md diff --git a/level_0/6-comparison-ops/io.json b/level_0/9-comparison-ops/io.json similarity index 100% rename from level_0/6-comparison-ops/io.json rename to level_0/9-comparison-ops/io.json diff --git a/level_0/6-comparison-ops/meta.json b/level_0/9-comparison-ops/meta.json similarity index 64% rename from level_0/6-comparison-ops/meta.json rename to level_0/9-comparison-ops/meta.json index 67c4371d..4d0cae9f 100644 --- a/level_0/6-comparison-ops/meta.json +++ b/level_0/9-comparison-ops/meta.json @@ -1,8 +1,8 @@ { - "title": "6: Comparison Operators", + "title": "9: Comparison Operators", "name": "ten_or_greater", "difficulty": "easy", - "author": "", + "author": "Luke Weaver", "category": "Level 0", "question_type": [ "coding" diff --git a/level_0/9-comparison-ops/starter.py b/level_0/9-comparison-ops/starter.py new file mode 100644 index 00000000..e69de29b diff --git a/level_0/calculate-absolute/description.md b/level_0/calculate-absolute/description.md new file mode 100644 index 00000000..ae84cb89 --- /dev/null +++ b/level_0/calculate-absolute/description.md @@ -0,0 +1,8 @@ +Write a function `calculate_absolute(n: int) -> int` that takes an integer `n` as input and returns its absolute value. The absolute value of a number is its non-negative value. + +For example: +- `calculate_absolute(-5)` → `5` +- `calculate_absolute(7)` → `7` +- `calculate_absolute(0)` → `0` + +You may want to Google how to find the absolute value of an `int` in Python! There are many useful pre-made functions like this one, check them out! \ No newline at end of file diff --git a/level_0/calculate-absolute/io.json b/level_0/calculate-absolute/io.json new file mode 100644 index 00000000..efc5b14b --- /dev/null +++ b/level_0/calculate-absolute/io.json @@ -0,0 +1,42 @@ +[ + { + "input": [-5], + "output": 5 + }, + { + "input": [7], + "output": 7 + }, + { + "input": [0], + "output": 0 + }, + { + "input": [-123], + "output": 123 + }, + { + "input": [999], + "output": 999 + }, + { + "input": [-10000], + "output": 10000 + }, + { + "input": [55], + "output": 55 + }, + { + "input": [-1024], + "output": 1024 + }, + { + "input": [43110], + "output": 43110 + }, + { + "input": [-1], + "output": 1 + } +] diff --git a/level_0/calculate-absolute/meta.json b/level_0/calculate-absolute/meta.json new file mode 100644 index 00000000..966efe34 --- /dev/null +++ b/level_0/calculate-absolute/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Calculate Absolute", + "name": "calculate_absolute", + "difficulty": "easy", + "author": "ChatGPT", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/calculate-absolute/starter.py b/level_0/calculate-absolute/starter.py new file mode 100644 index 00000000..e69de29b diff --git a/level_0/is-even/description.md b/level_0/is-even/description.md new file mode 100644 index 00000000..e0e731a0 --- /dev/null +++ b/level_0/is-even/description.md @@ -0,0 +1,8 @@ +Write a function `is_even(num)` that takes an integer `num` as input and returns `True` if the integer is even, and `False` otherwise. + +For example: +- `is_even(4)` -> `True` +- `is_even(7)` -> `False` +- `is_even(0)` -> `True` + +**Hint:** This problem is all about finding the remainder of a division. Recall the earlier "Math Operations 2" problem. \ No newline at end of file diff --git a/level_0/is-even/io.json b/level_0/is-even/io.json new file mode 100644 index 00000000..36d40ba8 --- /dev/null +++ b/level_0/is-even/io.json @@ -0,0 +1,42 @@ +[ + { + "input": [4], + "output": true + }, + { + "input": [7], + "output": false + }, + { + "input": [0], + "output": true + }, + { + "input": [-2], + "output": true + }, + { + "input": [13], + "output": false + }, + { + "input": [100], + "output": true + }, + { + "input": [57], + "output": false + }, + { + "input": [-1000], + "output": true + }, + { + "input": [19], + "output": false + }, + { + "input": [20], + "output": true + } +] diff --git a/level_0/is-even/meta.json b/level_0/is-even/meta.json new file mode 100644 index 00000000..e3ee20e4 --- /dev/null +++ b/level_0/is-even/meta.json @@ -0,0 +1,10 @@ +{ + "title": "Is Even", + "name": "is_even", + "difficulty": "easy", + "author": "", + "category": "Level 0", + "question_type": [ + "coding" + ] +} \ No newline at end of file diff --git a/level_0/is-even/starter.py b/level_0/is-even/starter.py new file mode 100644 index 00000000..e69de29b From 832fb8512cbd046421e74cd61d28fe5b243c9287 Mon Sep 17 00:00:00 2001 From: Luke Weaver Date: Tue, 26 May 2026 14:07:49 -0400 Subject: [PATCH 26/26] Allow validate_problems to not fail on empty starter.py --- .../calculate-absolute/description.md | 4 -- fundamentals/calculate-absolute/io.json | 42 ------------------- fundamentals/calculate-absolute/meta.json | 10 ----- fundamentals/calculate-absolute/starter.py | 3 -- fundamentals/is-even/description.md | 7 ---- fundamentals/is-even/io.json | 42 ------------------- fundamentals/is-even/meta.json | 10 ----- fundamentals/is-even/starter.py | 3 -- string_1/greeting/description.md | 4 -- string_1/greeting/io.json | 15 ------- string_1/greeting/meta.json | 10 ----- string_1/greeting/starter.py | 3 -- string_1/html-tagged/description.md | 2 - string_1/html-tagged/io.json | 15 ------- string_1/html-tagged/meta.json | 8 ---- string_1/html-tagged/starter.py | 3 -- validate_problems.py | 15 ++++--- 17 files changed, 9 insertions(+), 187 deletions(-) delete mode 100644 fundamentals/calculate-absolute/description.md delete mode 100644 fundamentals/calculate-absolute/io.json delete mode 100644 fundamentals/calculate-absolute/meta.json delete mode 100644 fundamentals/calculate-absolute/starter.py delete mode 100644 fundamentals/is-even/description.md delete mode 100644 fundamentals/is-even/io.json delete mode 100644 fundamentals/is-even/meta.json delete mode 100644 fundamentals/is-even/starter.py delete mode 100644 string_1/greeting/description.md delete mode 100644 string_1/greeting/io.json delete mode 100644 string_1/greeting/meta.json delete mode 100644 string_1/greeting/starter.py delete mode 100644 string_1/html-tagged/description.md delete mode 100644 string_1/html-tagged/io.json delete mode 100644 string_1/html-tagged/meta.json delete mode 100644 string_1/html-tagged/starter.py diff --git a/fundamentals/calculate-absolute/description.md b/fundamentals/calculate-absolute/description.md deleted file mode 100644 index 837c666a..00000000 --- a/fundamentals/calculate-absolute/description.md +++ /dev/null @@ -1,4 +0,0 @@ -Write a function `calculate_absolute(n: int) -> int` that takes an integer `n` as input and returns its absolute value. The absolute value of a number is its non-negative value, so if the input is `-5`, the output should be `5`, and if the input is `7`, the output should be `7`. - - -**Hint**: You may want to Google how to find the absolute value of an integer in Python! \ No newline at end of file diff --git a/fundamentals/calculate-absolute/io.json b/fundamentals/calculate-absolute/io.json deleted file mode 100644 index 2321a200..00000000 --- a/fundamentals/calculate-absolute/io.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "input": [-5], - "output": 5 - }, - { - "input": [3], - "output": 3 - }, - { - "input": [0], - "output": 0 - }, - { - "input": [-123], - "output": 123 - }, - { - "input": [999], - "output": 999 - }, - { - "input": [-10000], - "output": 10000 - }, - { - "input": [55], - "output": 55 - }, - { - "input": [-1024], - "output": 1024 - }, - { - "input": [43110], - "output": 43110 - }, - { - "input": [-1], - "output": 1 - } -] diff --git a/fundamentals/calculate-absolute/meta.json b/fundamentals/calculate-absolute/meta.json deleted file mode 100644 index c3add9e8..00000000 --- a/fundamentals/calculate-absolute/meta.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "Calculate Absolute", - "name": "calculate_absolute", - "difficulty": "easy", - "author": "ChatGPT", - "category": "Fundamentals", - "question_type": [ - "coding" - ] -} \ No newline at end of file diff --git a/fundamentals/calculate-absolute/starter.py b/fundamentals/calculate-absolute/starter.py deleted file mode 100644 index 30e071e6..00000000 --- a/fundamentals/calculate-absolute/starter.py +++ /dev/null @@ -1,3 +0,0 @@ -def calculate_absolute(n: int) -> int: - # Your code here - pass \ No newline at end of file diff --git a/fundamentals/is-even/description.md b/fundamentals/is-even/description.md deleted file mode 100644 index a22a1178..00000000 --- a/fundamentals/is-even/description.md +++ /dev/null @@ -1,7 +0,0 @@ -Write a function `is_even(n: int) -> bool` that takes an integer `n` as input and returns `True` if the integer is even, and `False` otherwise. - -For example: -- `is_even(4)` -> `True` (because `4` is an even number) - - -**Hint:** This problem is all about finding the remainder of a division. Google how to do this in Python. \ No newline at end of file diff --git a/fundamentals/is-even/io.json b/fundamentals/is-even/io.json deleted file mode 100644 index 36d40ba8..00000000 --- a/fundamentals/is-even/io.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "input": [4], - "output": true - }, - { - "input": [7], - "output": false - }, - { - "input": [0], - "output": true - }, - { - "input": [-2], - "output": true - }, - { - "input": [13], - "output": false - }, - { - "input": [100], - "output": true - }, - { - "input": [57], - "output": false - }, - { - "input": [-1000], - "output": true - }, - { - "input": [19], - "output": false - }, - { - "input": [20], - "output": true - } -] diff --git a/fundamentals/is-even/meta.json b/fundamentals/is-even/meta.json deleted file mode 100644 index 030f1de1..00000000 --- a/fundamentals/is-even/meta.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "Is Even", - "name": "is_even", - "difficulty": "easy", - "author": "ChatGPT", - "category": "Fundamentals", - "question_type": [ - "coding" - ] -} \ No newline at end of file diff --git a/fundamentals/is-even/starter.py b/fundamentals/is-even/starter.py deleted file mode 100644 index ae160874..00000000 --- a/fundamentals/is-even/starter.py +++ /dev/null @@ -1,3 +0,0 @@ -def is_even(n: int) -> bool: - # Your code here - pass \ No newline at end of file diff --git a/string_1/greeting/description.md b/string_1/greeting/description.md deleted file mode 100644 index 9db53064..00000000 --- a/string_1/greeting/description.md +++ /dev/null @@ -1,4 +0,0 @@ -Write a function `hello_greeting(name: str) -> str` that returns a greeting of the form `"Hello Name!"`, where `Name` is the input string. -Examples: -- `"Bob"` → `"Hello Bob!"` -- `"Alice"` → `"Hello Alice!"` \ No newline at end of file diff --git a/string_1/greeting/io.json b/string_1/greeting/io.json deleted file mode 100644 index 6a9ca02f..00000000 --- a/string_1/greeting/io.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - {"input": ["Bob"], "output": "Hello Bob!"}, - {"input": ["Alice"], "output": "Hello Alice!"}, - {"input": ["Eric"], "output": "Hello Eric!"}, - {"input": ["John Doe"], "output": "Hello John Doe!"}, - {"input": ["Jane Smith"], "output": "Hello Jane Smith!"}, - {"input": ["O'Neil"], "output": "Hello O'Neil!"}, - {"input": ["Li"], "output": "Hello Li!"}, - {"input": ["Anne-Marie"], "output": "Hello Anne-Marie!"}, - {"input": ["😊"], "output": "Hello 😊!"}, - {"input": ["123"], "output": "Hello 123!"}, - {"input": ["Dr. Robert"], "output": "Hello Dr. Robert!"}, - {"input": [" "], "output": "Hello !"}, - {"input": ["Jean-Luc"], "output": "Hello Jean-Luc!"} -] \ No newline at end of file diff --git a/string_1/greeting/meta.json b/string_1/greeting/meta.json deleted file mode 100644 index 70e76ffb..00000000 --- a/string_1/greeting/meta.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "title": "Hello Greeting", - "name": "hello_greeting", - "difficulty": "easy", - "author": "ChatGPT, edited by Eric", - "category": "String-1", - "question_type": [ - "coding" - ] -} \ No newline at end of file diff --git a/string_1/greeting/starter.py b/string_1/greeting/starter.py deleted file mode 100644 index c7ead610..00000000 --- a/string_1/greeting/starter.py +++ /dev/null @@ -1,3 +0,0 @@ -def hello_greeting(name: str) -> str: - # Your code here - pass \ No newline at end of file diff --git a/string_1/html-tagged/description.md b/string_1/html-tagged/description.md deleted file mode 100644 index 4cf26e2e..00000000 --- a/string_1/html-tagged/description.md +++ /dev/null @@ -1,2 +0,0 @@ -Write a function `html_bracket(s: str) -> str` that returns the string with '`<`' prepended and '`>`' appended. -Example: `"code"` → `""`. \ No newline at end of file diff --git a/string_1/html-tagged/io.json b/string_1/html-tagged/io.json deleted file mode 100644 index adb2e94f..00000000 --- a/string_1/html-tagged/io.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - {"input": ["code"], "output": ""}, - {"input": [""], "output": "<>"}, - {"input": ["123"], "output": "<123>"}, - {"input": [""], "output": "<>"}, - {"input": ["&"], "output": "<&>"}, - {"input": ["hello world"], "output": ""}, - {"input": ["!"], "output": ""}, - {"input": ["a"], "output": ""}, - {"input": ["<>"], "output": "<<>>"}, - {"input": ["{}"], "output": "<{}>"}, - {"input": ["<>123"], "output": "<<>123>"}, - {"input": ["😀"], "output": "<😀>"}, - {"input": [""], "output": "<>"} -] diff --git a/string_1/html-tagged/meta.json b/string_1/html-tagged/meta.json deleted file mode 100644 index fb76000e..00000000 --- a/string_1/html-tagged/meta.json +++ /dev/null @@ -1,8 +0,0 @@ -{"title": "Add HTML Angle Brackets", -"name": "html_bracket", -"difficulty": "easy", -"author": "ChatGPT, edited by Eric", -"category": "String-1", -"question_type": [ - "coding" -]} \ No newline at end of file diff --git a/string_1/html-tagged/starter.py b/string_1/html-tagged/starter.py deleted file mode 100644 index b59e074c..00000000 --- a/string_1/html-tagged/starter.py +++ /dev/null @@ -1,3 +0,0 @@ -def html_bracket(s: str) -> str: - # Your code here - pass \ No newline at end of file diff --git a/validate_problems.py b/validate_problems.py index 2bedf86e..71f34508 100755 --- a/validate_problems.py +++ b/validate_problems.py @@ -97,12 +97,15 @@ def validate_problem(problem_path, rel_path): if not os.path.isfile(st): error(rel_path, "missing starter.py for coding/haystack question") else: - # ensure function def matches meta.name - if name: - content = open(st, encoding='utf-8').read() - pat = rf"def\s+{re.escape(name)}\s*\(" - if not re.search(pat, content): - error(rel_path, f"starter.py does not define function '{name}()'") + # ensure starter.py either defines a function that matches meta.name or is empty + content = open(st, encoding='utf-8').read() + if content.strip(): # non-empty - validate function name + if not name: + error(rel_path, "starter.py is non-empty but meta.json has no 'name' field to validate against") + else: + pat = rf"def\s+{re.escape(name)}\s*\(" + if not re.search(pat, content): + error(rel_path, f"starter.py is non-empty and does not define function '{name}()'") # should not have mutation files muts = glob.glob(os.path.join(problem_path, 'mutation_*.py')) if muts: