summaryrefslogtreecommitdiff
path: root/assignments
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-01-23 09:04:07 -0700
committermo khan <mo@mokhan.ca>2025-01-23 09:04:07 -0700
commit329cb0e9e67ba0e894a3a1ab9b251d29294499b9 (patch)
tree8801c036ded6b6e708bc24732123ac6f4ad5b5e0 /assignments
parent7f03450427ceb527d7752d66dd3200a57e09a6b1 (diff)
Start assignment 4
Diffstat (limited to 'assignments')
-rw-r--r--assignments/4-solution.md12
-rw-r--r--assignments/4/main.py9
2 files changed, 21 insertions, 0 deletions
diff --git a/assignments/4-solution.md b/assignments/4-solution.md
index 109042c..43c7781 100644
--- a/assignments/4-solution.md
+++ b/assignments/4-solution.md
@@ -7,6 +7,18 @@ There are no chapter end exercises for Chapter 9.
Chapter 10:
+> 9. In Python, indentation is used to indicate the extent of a block of code. What is the output of the following Python code?
+
+```python
+!include assignments/4/main.py
+```
+
+```bash
+$ python assignments/4/main.py
+second is bigger
+first is bigger
+```
+
Chapter 11:
Chapter 12:
diff --git a/assignments/4/main.py b/assignments/4/main.py
new file mode 100644
index 0000000..110e1a0
--- /dev/null
+++ b/assignments/4/main.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+first = 3
+second = 5
+if first < second:
+ print("second is bigger")
+else:
+ print("but this time ")
+print("first is bigger")