Skip to content

Commit b9d1836

Browse files
committed
Added week 1 exercise worked examples
1 parent c0c57af commit b9d1836

9 files changed

Lines changed: 2551 additions & 3 deletions

File tree

CH40208/_toc.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,19 @@ parts:
104104
- caption: Planning Your Code
105105
chapters:
106106
- file: code_schematics/code_schematics.md
107+
108+
- caption: Exercise Worked Examples
109+
chapters:
110+
- file: worked_examples/week_1_index
111+
title: Week 1
112+
sections:
113+
- file: worked_examples/week_1_calculator
114+
title: Using Python as a Calculator
115+
- file: worked_examples/week_1_strings
116+
title: Getting Started with Strings
117+
- file: worked_examples/week_1_arithmetic
118+
title: Arithmetic
119+
- file: worked_examples/week_1_lists
120+
title: Lists
121+
- file: worked_examples/week_1_dictionaries
122+
title: Dictionaries

CH40208/course_contents/week_1.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [Types](../python_basics/types.ipynb)
1515
- [Variables](../python_basics/variables.ipynb)
1616
- [Arithmetic](../python_basics/arithmetic.ipynb)
17-
- [Lists](../python_basics/lists.md)
17+
- [Lists](../python_basics/lists.ipynb)
18+
- [Loops](../python_basics/loops.ipynb)
1819
- [Tuples](../python_basics/tuples.ipynb)
1920
- [Dictionaries](../python_basics/dictionaries.ipynb)

CH40208/python_basics/using_Python_as_a_calculator.ipynb

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,14 +527,21 @@
527527
"\n",
528528
"After trying out the examples above, test your understanding with these exercises:\n",
529529
"\n",
530-
"1. Calculate the volume of a sphere with radius 5 units. (Hint: Use `math.pi` and remember the formula is $V = \\frac{4}{3} \\pi r^3$).\n",
530+
"1. Calculate the volume of a sphere with a radius of 5 units. (Hint: Use `math.pi` and remember the formula is $V = \\frac{4}{3} \\pi r^3$).\n",
531531
"2. Convert 45 degrees to radians. (Hint: Use `math.radians()`)\n",
532532
"3. Calculate the log base 2 of 32. (Hint: You can use `math.log(x, base)`)\n",
533533
"\n",
534534
"- Remember to `import math` before using any math functions.\n",
535535
"- Be aware that 5/2 gives a float result (2.5), while 5//2 gives an integer result (2).\n",
536536
"- Python follows the standard order of operations (BODMAS). Use parentheses when in doubt."
537537
]
538+
},
539+
{
540+
"cell_type": "code",
541+
"execution_count": null,
542+
"metadata": {},
543+
"outputs": [],
544+
"source": []
538545
}
539546
],
540547
"metadata": {
@@ -553,7 +560,7 @@
553560
"name": "python",
554561
"nbconvert_exporter": "python",
555562
"pygments_lexer": "ipython3",
556-
"version": "3.11.1"
563+
"version": "3.12.9"
557564
}
558565
},
559566
"nbformat": 4,

0 commit comments

Comments
 (0)