Learn Python from zero to hero β Malaysian style! π²πΎ
A complete, beginner-friendly Python learning guide with hands-on lessons, exercises, and solutions. Written in fun Malaysian English so you won't fall asleep reading code. Confirm shiok one!
Each lesson is a standalone .py file you can read and run. No Jupyter needed!
| # | Lesson | Topics |
|---|---|---|
| 00 | Hello Python! | print(), comments, running Python |
| 01 | Variables & Types | int, float, str, bool, type(), casting |
| 02 | Operators | Arithmetic, comparison, logical, assignment |
| 03 | Strings | Methods, slicing, concatenation, formatting |
| 04 | Lists | Creating, modifying, list comprehensions |
| 05 | Tuples & Sets | Immutability, unpacking, set operations |
| 06 | Dictionaries | Key-value pairs, .items(), comprehensions |
| 07 | Control Flow | if/elif/else, ternary, truthy/falsy, match |
| 08 | Loops | for, while, break, continue, enumerate, zip |
| 09 | Functions | def, return, *args, **kwargs, lambda, scope |
| 10 | f-strings & Formatting | f-strings, .format(), .join(), alignment |
| 11 | File I/O | Reading, writing, appending, CSV |
| 12 | Error Handling | try/except, raising, custom exceptions |
| 13 | Modules & Imports | Standard library, pip, creating modules |
Practice what you've learned! Each exercise has # TODO markers for you to fill in.
| # | Exercise | Solution |
|---|---|---|
| 01 | Variables | Solutions |
| 02 | Operators | Solutions |
| 03 | Strings | Solutions |
| 04 | Lists | Solutions |
| 05 | Tuples & Sets | Solutions |
| 06 | Dictionaries | Solutions |
| 07 | Control Flow | Solutions |
| 08 | Loops | Solutions |
| 09 | Functions | Solutions |
| 10 | f-strings | Solutions |
- Python 3.10+ β Download here
β οΈ During installation, make sure to check "Add Python to PATH"!
-
Clone this repo:
git clone https://github.com/subimpact/python-fundamentals.git cd python-fundamentals -
Set up a Virtual Environment (venv) β Sangat Recommended! π‘οΈ To avoid polluting your global system packages, create and activate a Python virtual environment:
- Windows (PowerShell):
python -m venv venv .\venv\Scripts\Activate.ps1 - Windows (Command Prompt):
python -m venv venv venv\Scripts\activate.bat
- macOS / Linux:
python3 -m venv venv source venv/bin/activate
- Windows (PowerShell):
-
Install Dependencies:
pip install -r requirements.txt
-
Read and run lessons in order:
python lessons/00_hello_python.py python lessons/01_variables_and_types.py # ... and so on(Need to verify if your console output matches what it should? Check EXPECTED_OUTPUTS.md!)
-
Try the exercises:
# Open the exercise file, fill in the TODOs # Then run it. There are built-in Malaysian checkers to guide you! python exercises/01_variables_exercises.py # Check the solutions when you're done: python solutions/01_variables_solutions.py
requirements.txt includes black and flake8 so you can learn good code standards from day one:
black --check lessons/ # Is your code formatted the standard way?
flake8 exercises/ # Any style or logic warnings?You don't need to use them to finish the course β but learning them early makes your code look professional.
- π Read the lesson file (it's heavily commented β just read it like a book!)
βΆοΈ Run the lesson and verify your output matches EXPECTED_OUTPUTS.md- π§ͺ Try modifying the code to experiment
- βοΈ Do the matching exercise and run it to trigger the automated checker
- β Check the solution
- β‘οΈ Move to the next lesson
For absolute beginners, here is a realistic guide on how long it takes to finish this course:
- Per Topic (Lesson + Exercise + Solution): ~30 to 45 minutes
- 15-20 mins: Read the lesson file, run it, and experiment.
- 15-25 mins: Code the exercise, debug with the checker, and review the solution.
- Full Repository Playthrough: 6 to 8 hours of total hands-on learning.
π Recommended Learning Paths:
- The "Teh Tarik" Weekend Sprint β: Dedicate 3-4 hours on Saturday and Sunday. You'll be coding comfortably by Sunday night!
- The Self-Paced Mamak Plan π: Do 2 topics a day (approx. 1 hour total). You'll finish everything in exactly one week, confirm steady!
- Absolute beginners who have never coded before
- Students starting a CS or data science course
- Developers from other languages picking up Python
- Anyone who wants a fun, easy-to-follow Python refresher
python-fundamentals/
βββ README.md β You are here!
βββ LICENSE β MIT License
βββ .gitignore β Git ignore rules
βββ EXPECTED_OUTPUTS.md β What each lesson should print
βββ rubric_scoring.md β The 20-point beginner-friendliness rubric
βββ lessons/ β 14 lesson files (read + run these!)
β βββ 00_hello_python.py
β βββ 01_variables_and_types.py
β βββ ...
β βββ 13_modules_and_imports.py
βββ exercises/ β Practice problems (fill in the TODOs!)
β βββ 01_variables_exercises.py
β βββ ...
β βββ 10_fstrings_exercises.py
βββ solutions/ β Answers for exercises
βββ 01_variables_solutions.py
βββ ...
βββ 10_fstrings_solutions.py
Found a typo? Have a better example? Want to add more exercises?
- Fork this repo
- Create a branch:
git checkout -b my-improvement - Make your changes
- Submit a pull request
All contributions are welcome!
This project is licensed under the MIT License β see LICENSE for details.
- Original content inspired by DeepLearning.AI's Python refresher lab
- Written with love from Malaysia π²πΎ
- Powered by nasi lemak and teh tarik β
Happy coding! Jom belajar Python! ππ