Skip to content

Commit 5e0a2e0

Browse files
authored
Update README.md to follow story-driven tasks. Yet do to test suite
1 parent f71540e commit 5e0a2e0

1 file changed

Lines changed: 35 additions & 14 deletions

File tree

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,45 @@
1-
# Exercise 02 - Datatypes
1+
# Exercise 02 — Space Station Diagnostic System
22

33
## Description
4-
Welcome to your first real excercise. In the last one, we checked if everything is working correctly, now its time to put your knowlege to test. This and feature excercises contain multiple tests which are skipped by default (only first one is enabled). Your job is to finish one thing at a time and run the test. To run the next test, go to `test_<lesson_name>.py` and remove the `@pytest.mark.skip` line from the next test. Your goal is to make all tests pass.
4+
Welcome aboard the ORION-9 deep-space research station! The central terminal suffered a reboot after a cosmic flare. Before life support and navigation systems can come back online, you must manually declare and initialize the core system variables.
55

6-
In this excercise you will define datatypes we talked about in lesson: **String**, **Integer**, **Float**, **Boolean**, **None**.
6+
This exercise will guide you through Python's core data types: **String**, **Integer**, **Float**, **Boolean**, and **None**, along with basic type casting and printing.
77

8-
You need to define the following variables:
9-
* `mystring` - set it to some string
10-
* `myinteger` - set it to some integer
11-
* `myfloat` - set it to some float
12-
* `myboolean` - set it to some boolean
13-
* `mynonevalue` - set it to some None
8+
---
149

15-
You need to make sure the variables are named **exactly** like written here, otherwise the tests will fail, values can be anything you want.
10+
## Tasks
1611

17-
### Run the tests
18-
To run the tests, run the following command in the directory root (`python-excercises`):
12+
### Task 1: Initialize System Identity
13+
Declare the station's core identification variables:
14+
* `station_name` — a **string** representing the station name (e.g., `"Orion 9"`)
15+
* `module_count` — an **integer** representing active station modules (e.g., `12`)
16+
* `signal_frequency` — a **float** representing the sub-space signal frequency (e.g., `1420.405`)
17+
* `life_support_active` — a **boolean** set to `True`
18+
* `backup_generator` — set to `None` (representing an offline component)
19+
20+
> **Next step:** Run the test suite. If `test_task_1` passes, open `test_core_datatypes.py` and remove the `@pytest.mark.skip` line above `test_task_2`.
21+
22+
### Task 2: Type Casting & Calibration
23+
The telemetry unit sent data in the wrong format! Fix the formats using type casting:
24+
* `raw_energy_reading` is provided as `"100"` (a string). Create a new variable `energy_level` by casting `raw_energy_reading` to an **integer**.
25+
* `raw_distance_reading` is provided as `45` (an integer). Create a new variable `exact_distance` by casting `raw_distance_reading` to a **float**.
26+
* `raw_status_code` is provided as `1` (an integer). Create a new variable `is_operational` by casting `raw_status_code` to a **boolean**.
27+
28+
> **Next step:** Run the test suite. If `test_task_2` passes, open `test_core_datatypes.py` and remove the `@pytest.mark.skip` line above `test_task_3`.
29+
30+
### Task 3: Terminal Broadcast
31+
* Create a variable `station_status` by converting `module_count` to a string and concatenating it with `station_name` (e.g., `"12 - Orion 9"`).
32+
* Print `station_status` to the terminal console using the `print()` function.
33+
34+
> **Next step:** Run the test suite. If `test_task_3` passes, congrats! You have completed then exercise.
35+
36+
---
37+
38+
## How to Run the Tests
39+
Run the following command from the root directory:
1940
```bash
2041
python check.py 02
2142
```
2243

23-
## Notes
24-
To finish this excercise, visit our first lesson in TPL - [Datatypes](https://thepythonledger.github.io/Docusaurus-engine/lessons/python-foundations/core-datatypes)
44+
## Resources
45+
Review the core concepts in [The Python Ledger lesson on Core Datatypes](https://thepythonledger.github.io/Docusaurus-engine/lessons/python-foundations/core-datatypes).

0 commit comments

Comments
 (0)