Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions python-skill-assessment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Python Skill Assessment: How to Evaluate Your Knowledge

This folder contains the materials for the Real Python tutorial [Python Skill Assessment: How to Evaluate Your Knowledge](https://realpython.com/python-skill-assessment/).

- `python-skill-assessment-worksheet.md`: The blank worksheet to fill in
- `python-skill-assessment-worksheet-example.md`: A filled-in example worksheet
- `probes/`: One short code probe for each level, covering the topics that the Python Skill Test doesn't ask about

To check a rating, predict a probe's output, and then run it:

```console
$ cd probes/
$ python novice.py
```

The probes run on Python 3.15 and need no third-party packages, so there's no `requirements.txt`.
19 changes: 19 additions & 0 deletions python-skill-assessment/probes/expert.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Registry(type):
names = []

def __new__(mcs, name, bases, namespace):
cls = super().__new__(mcs, name, bases, namespace)
Registry.names.append(name)
return cls


class Plugin(metaclass=Registry):
pass


class CSVExport(Plugin):
pass


print(Registry.names)
print(type(CSVExport).__name__)
8 changes: 8 additions & 0 deletions python-skill-assessment/probes/intermediate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import json
from collections import Counter

words = "the cat and the hat and the bat".split()
counts = Counter(words)

print(counts.most_common(2))
print(json.dumps(counts.most_common(1)))
12 changes: 12 additions & 0 deletions python-skill-assessment/probes/novice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cookies = 7
friends = 2

each = cookies // friends
left_over = cookies % friends

if left_over == 0:
print(f"Everyone gets {each}, with none left over")
else:
print(f"Everyone gets {each}, with {left_over} left over")

print(cookies / friends)
14 changes: 14 additions & 0 deletions python-skill-assessment/probes/proficient.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def shout(func):
def wrapper(name):
return func(name).upper() + "!"

return wrapper


@shout
def greet(name):
return f"hello, {name}"


print(greet("jane"))
print(greet.__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Python Skill Assessment Worksheet (Filled-In Example)

This is an example of a finished worksheet. The ratings and notes are made up. Use the blank worksheet for your own.

Rate each statement from 1 to 4:

| Rating | Meaning |
|--------|---------|
| 1 | I can't do this yet. |
| 2 | I've seen it, but I need to look it up. |
| 3 | I can do it, but I'm not sure I could teach it. |
| 4 | I can do it and explain it to someone else. |

Rate what you can do without looking anything up. For a statement with several skills, rate your weakest one.

The "Quiz question" column names the question in the Real Python [Python Skill Test](https://realpython.com/quizzes/python-skill-test/) that covers the same topic, so you can compare your rating with your result.

## Part 1: Rate Yourself Against Each Level

### Novice (Quiz score 0-3)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| display values with `print()`. | 4 | Using print() | Daily. |
| define a function with `def`, pass arguments, and return a value. | 4 | Define a Function | |
| install a package from PyPI with `python -m pip install`, ideally inside a virtual environment. | 3 | Installing Packages | Forget `-m` sometimes. |
| explain that a `for` loop variable takes each element from an iterable, such as a string or a list. | 4 | Loop Anatomy | |
| use variables, operators, `if` statements, and basic built-in types (numbers, strings, lists). | 4 | Beyond the quiz | |

### Intermediate (Quiz score 4-7)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| tell mutable types (`list`) from immutable ones (`tuple`, `str`, `frozenset`). | 3 | Mutable Objects | Never used `frozenset`. |
| explain that dictionary keys must be hashable and that insertion order is kept since Python 3.7. | 3 | Dictionary Facts | Hashable: fuzzy. |
| read and write list comprehensions, including an `if` filter, and rewrite them as a `for` loop. | 4 | Understanding List Comprehensions | Nested ones slow me down. |
| use the standard library's common modules, such as `pathlib`, `collections`, `itertools`, and `json`, before reaching for third-party packages. | 3 | Beyond the quiz | |

### Proficient (Quiz score 8-11)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| explain what problem the `with` statement solves and why files close even when an exception occurs. | 2 | The With Statement | Use it, can't explain it. |
| recognize dunder methods such as `.__init__()` and `.__iadd__()` and say when Python calls them. | 2 | Spot the Dunder | Only `.__init__()`. |
| write a generator function with `yield` and explain why it's lazy. | 1 | Writing a Simple Generator | Never wrote one. |
| write and apply decorators, and explain how iterators and iterables work. | 2 | Beyond the quiz | |

### Expert (Quiz score 12)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| predict attribute lookup when data descriptors, non-data descriptors, and instance attributes compete. | 1 | Descriptor Precedence in Practice | New to me. |
| trace the C3 method resolution order and predict the output of cooperative `super()` calls. | 1 | Cooperative super() and the C3 MRO | Single inheritance only. |
| explain what a metaclass does, and write basic `async` code with `asyncio`. | 1 | Beyond the quiz | |

## Part 2: Reconcile Your Self-Rating With the Quiz

Average your ratings for each level, including the _Beyond the quiz_ row, take the quiz, and then fill in the quiz columns. The quiz reports one overall result, so use the explanations for each question you missed to fill in the per-level column.

| Level | Your average rating | Quiz questions missed | Gap (rating vs. result) |
|-------|---------------------|-----------------------|-------------------------|
| Novice | 3.8 | 0 | None |
| Intermediate | 3.3 | 1 (Dictionary Facts) | One miss: a hint, so recheck hashable keys |
| Proficient | 1.8 | 2 (Spot the Dunder, Writing a Simple Generator) | Low rating, two of three missed: matches |
| Expert | 1.0 | 2 (both) | Low rating, both missed: matches |

**Overall quiz result:** Intermediate (7 of 12 correct)

**Self-rated level** (the highest level whose average, and every average below it, is 3 or more, or _Not yet Novice_ if your Novice average is below 3): Intermediate

**Do they match?** Yes. Next step: Proficient.

## Part 3: Turn Your Weakest Area Into a Study Plan

| Question | Your answer |
|----------|-------------|
| My weakest area (the lowest-level miss that your check confirmed, or your lowest-rated statement at the lowest level) | Dictionary Facts: why keys must be hashable |
| Why it matters for my goals | My scripts group records in dictionaries keyed by tuples |
| One resource I'll use | [Dictionaries in Python](https://realpython.com/python-dicts/) |
| What I'll do with it this week | Try a list as a key, read the error, and explain hashability in my notes |
| Hours I can set aside per week | 3 |
| Date I'll retake the quiz | Four weeks from today |
80 changes: 80 additions & 0 deletions python-skill-assessment/python-skill-assessment-worksheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Python Skill Assessment Worksheet

Rate each statement from 1 to 4:

| Rating | Meaning |
|--------|---------|
| 1 | I can't do this yet. |
| 2 | I've seen it, but I need to look it up. |
| 3 | I can do it, but I'm not sure I could teach it. |
| 4 | I can do it and explain it to someone else. |

Rate what you can do without looking anything up. For a statement with several skills, rate your weakest one.

The "Quiz question" column names the question in the Real Python [Python Skill Test](https://realpython.com/quizzes/python-skill-test/) that covers the same topic, so you can compare your rating with your result.

## Part 1: Rate Yourself Against Each Level

### Novice (Quiz score 0-3)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| display values with `print()`. | | Using print() | |
| define a function with `def`, pass arguments, and return a value. | | Define a Function | |
| install a package from PyPI with `python -m pip install`, ideally inside a virtual environment. | | Installing Packages | |
| explain that a `for` loop variable takes each element from an iterable, such as a string or a list. | | Loop Anatomy | |
| use variables, operators, `if` statements, and basic built-in types (numbers, strings, lists). | | Beyond the quiz | |

### Intermediate (Quiz score 4-7)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| tell mutable types (`list`) from immutable ones (`tuple`, `str`, `frozenset`). | | Mutable Objects | |
| explain that dictionary keys must be hashable and that insertion order is kept since Python 3.7. | | Dictionary Facts | |
| read and write list comprehensions, including an `if` filter, and rewrite them as a `for` loop. | | Understanding List Comprehensions | |
| use the standard library's common modules, such as `pathlib`, `collections`, `itertools`, and `json`, before reaching for third-party packages. | | Beyond the quiz | |

### Proficient (Quiz score 8-11)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| explain what problem the `with` statement solves and why files close even when an exception occurs. | | The With Statement | |
| recognize dunder methods such as `.__init__()` and `.__iadd__()` and say when Python calls them. | | Spot the Dunder | |
| write a generator function with `yield` and explain why it's lazy. | | Writing a Simple Generator | |
| write and apply decorators, and explain how iterators and iterables work. | | Beyond the quiz | |

### Expert (Quiz score 12)

| I can... | Rating (1-4) | Quiz question | Notes |
|----------|--------------|---------------|-------|
| predict attribute lookup when data descriptors, non-data descriptors, and instance attributes compete. | | Descriptor Precedence in Practice | |
| trace the C3 method resolution order and predict the output of cooperative `super()` calls. | | Cooperative super() and the C3 MRO | |
| explain what a metaclass does, and write basic `async` code with `asyncio`. | | Beyond the quiz | |

## Part 2: Reconcile Your Self-Rating With the Quiz

Average your ratings for each level, including the _Beyond the quiz_ row, take the quiz, and then fill in the quiz columns. The quiz reports one overall result, so use the explanations for each question you missed to fill in the per-level column.

| Level | Your average rating | Quiz questions missed | Gap (rating vs. result) |
|-------|---------------------|-----------------------|-------------------------|
| Novice | | | |
| Intermediate | | | |
| Proficient | | | |
| Expert | | | |

**Overall quiz result:** _______ (___ of 12 correct)

**Self-rated level** (the highest level whose average, and every average below it, is 3 or more, or _Not yet Novice_ if your Novice average is below 3): _______

**Do they match?** _______

## Part 3: Turn Your Weakest Area Into a Study Plan

| Question | Your answer |
|----------|-------------|
| My weakest area (the lowest-level miss that your check confirmed, or your lowest-rated statement at the lowest level) | |
| Why it matters for my goals | |
| One resource I'll use | |
| What I'll do with it this week | |
| Hours I can set aside per week | |
| Date I'll retake the quiz | |
Loading