Skip to content

Commit 80b5140

Browse files
committed
Revert the koan file changes
1 parent 30fb0b6 commit 80b5140

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ A set of examples to learn optional static typing in Python.
66

77
- Install Python 3.9.4+.
88
- Install poetry - https://python-poetry.org/docs/#installation .
9-
- Clone the repository and change the directory to clone one.
9+
- Clone the repository and change the directory to the cloned one.
1010
- Install requirements like `poetry install`.
1111

1212
- If you want to use pip, `pip install -r requirements.txt`.
@@ -20,8 +20,42 @@ about Python hints. It starts with simple variable annotation and covers topics
2020

2121
### How to run?
2222

23+
- Display one koan file
24+
25+
``` bash
26+
$cat koans/py/100-easy-variable-wrong-type.py
27+
# msg variable is wrongly annotated as int, annotate it as string
28+
msg: int = "hello world!"
29+
30+
# salary is annotated as int, annotate as float
31+
salary: int = 2345.67
32+
33+
# Set is_active as bool
34+
is_active: int = True
35+
```
36+
2337
- Run one koan file
2438

39+
``` bash
40+
$poetry run python cli.py one koans/py/100-easy-variable-wrong-type.py
41+
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
42+
Running Mypy on koan file koans/py/100-easy-variable-wrong-type.py
43+
────────────────────────────────── Mypy errors in koan file koans/py/100-easy-variable-wrong-type.py ───────────────────────────────────
44+
koans/py/100-easy-variable-wrong-type.py:2: error: Incompatible types in assignment (expression has type "str", variable has type "int")
45+
msg: int = "hello world!"
46+
^
47+
koans/py/100-easy-variable-wrong-type.py:5: error: Incompatible types in assignment (expression has type "float", variable has type
48+
"int")
49+
salary: int = 2345.67
50+
^
51+
Found 2 errors in 1 file (checked 1 source file)
52+
53+
────────────────────────────────────────────────────────────────── End ──────────────────────────────────────────────────────────────────
54+
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
55+
```
56+
57+
- Run after fixing the errors(riddles) in the file.
58+
2559
``` bash
2660
$poetry run python cli.py one koans/py/100-easy-variable-wrong-type.py
2761
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# msg variable is wrongly annotated as int, annotate it as string
2-
msg: str = "hello world!"
2+
msg: int = "hello world!"
33

44
# salary is annotated as int, annotate as float
5-
salary: float = 2345.67
5+
salary: int = 2345.67
66

77
# Set is_active as bool
8-
is_active: bool = True
8+
is_active: int = True

0 commit comments

Comments
 (0)