dsba-python1-alpha 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: dsba-python1-alpha
3
+ Version: 0.1.0
4
+ Summary: Auto-checkers for the DSBA Python for Data Science course
5
+ Project-URL: Homepage, https://github.com/your-org/dsba-checkers
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Requires-Dist: numpy>=1.21
9
+ Requires-Dist: pandas>=1.3
10
+ Requires-Dist: scipy>=1.7
11
+ Description-Content-Type: text/markdown
12
+
13
+ # dsba-python1-alpha
14
+
15
+ Auto-checkers for the **DSBA Python for Data Science** course.
16
+ Inspired by Kaggle's `learntools` — same `.check()` / `.hint()` / `.solution()` API,
17
+ all datasets bundled inside the package (no internet required).
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ pip install dsba-python1-alpha
23
+ ```
24
+
25
+ ## Workshop 14 — scipy.stats
26
+
27
+ ```python
28
+ from dsba_checkers.workshops.w14_scipy import q1, q2, q3, q4, q5, q6, q7
29
+
30
+ # After writing your code:
31
+ q1.check(mean_charges, median_charges, skewness_charges, n_outliers)
32
+ # ✓ Correct!
33
+
34
+ # Stuck? Ask for a hint:
35
+ q1.hint()
36
+
37
+ # Give up? Show the solution (also shown automatically after 3 failed attempts):
38
+ q1.solution()
39
+ ```
40
+
41
+ ## Available workshops
42
+
43
+ | Module | Topic |
44
+ |--------|-------|
45
+ | `dsba_checkers.workshops.w14_scipy` | scipy.stats: descriptive stats, correlation, t-tests, Bonferroni |
46
+
47
+ More workshops coming in future versions.
@@ -0,0 +1,35 @@
1
+ # dsba-python1-alpha
2
+
3
+ Auto-checkers for the **DSBA Python for Data Science** course.
4
+ Inspired by Kaggle's `learntools` — same `.check()` / `.hint()` / `.solution()` API,
5
+ all datasets bundled inside the package (no internet required).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install dsba-python1-alpha
11
+ ```
12
+
13
+ ## Workshop 14 — scipy.stats
14
+
15
+ ```python
16
+ from dsba_checkers.workshops.w14_scipy import q1, q2, q3, q4, q5, q6, q7
17
+
18
+ # After writing your code:
19
+ q1.check(mean_charges, median_charges, skewness_charges, n_outliers)
20
+ # ✓ Correct!
21
+
22
+ # Stuck? Ask for a hint:
23
+ q1.hint()
24
+
25
+ # Give up? Show the solution (also shown automatically after 3 failed attempts):
26
+ q1.solution()
27
+ ```
28
+
29
+ ## Available workshops
30
+
31
+ | Module | Topic |
32
+ |--------|-------|
33
+ | `dsba_checkers.workshops.w14_scipy` | scipy.stats: descriptive stats, correlation, t-tests, Bonferroni |
34
+
35
+ More workshops coming in future versions.
@@ -0,0 +1,14 @@
1
+ """
2
+ dsba-python1-alpha
3
+ ──────────────────
4
+ Auto-checkers for the DSBA Python for Data Science course.
5
+
6
+ Quick start:
7
+ from dsba_checkers.workshops.w14_scipy import q1, q2, q3, q4, q5, q6, q7
8
+ q1.check(mean_charges, median_charges, skewness_charges, n_outliers)
9
+ q1.hint()
10
+ q1.solution()
11
+ """
12
+
13
+ __version__ = "0.1.0"
14
+ __author__ = "DSBA Python Course"
@@ -0,0 +1,56 @@
1
+ """Base class for all DSBA task checkers."""
2
+
3
+
4
+ class Task:
5
+ _hint = "No hint available for this task."
6
+ _solution = "No solution available for this task."
7
+ _max_attempts_before_solution = 3
8
+
9
+ def __init__(self):
10
+ self._attempts = 0
11
+
12
+ def check(self, *args, **kwargs):
13
+ self._attempts += 1
14
+ try:
15
+ result = self._check(*args, **kwargs)
16
+ except AssertionError as e:
17
+ self._print_wrong(str(e))
18
+ self._maybe_show_solution()
19
+ return
20
+ except TypeError as e:
21
+ print(f" ✗ Wrong argument types — did you pass the right variables?\n {e}")
22
+ return
23
+ except Exception as e:
24
+ print(f" ✗ Unexpected error:\n {type(e).__name__}: {e}")
25
+ return
26
+ if result is True or result is None:
27
+ self._print_correct()
28
+ else:
29
+ self._print_wrong(result if isinstance(result, str) else "")
30
+ self._maybe_show_solution()
31
+
32
+ def hint(self):
33
+ print(f"\n 💡 Hint:\n {self._hint}\n")
34
+
35
+ def solution(self):
36
+ print(f"\n 📋 Solution:\n{self._solution}\n")
37
+
38
+ def _check(self, *args, **kwargs):
39
+ raise NotImplementedError
40
+
41
+ def _print_correct(self):
42
+ print(" ✓ Correct!\n")
43
+
44
+ def _print_wrong(self, msg=""):
45
+ print(f" ✗ Not quite. {msg}\n" if msg else " ✗ Not quite. Check your logic and try again.\n")
46
+
47
+ def _maybe_show_solution(self):
48
+ if self._attempts >= self._max_attempts_before_solution:
49
+ print(f" (You've made {self._attempts} attempts — showing the solution.)")
50
+ self.solution()
51
+
52
+ @staticmethod
53
+ def _approx_equal(a, b, tol=0.01):
54
+ if b == 0:
55
+ return abs(a) < tol
56
+ return abs(a - b) / abs(b) < tol
@@ -0,0 +1 @@
1
+ # data sub-package — contains bundled CSV datasets