Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🐍 Python Fundamentals

Learn Python from zero to hero β€” Malaysian style! πŸ‡²πŸ‡Ύ

Python License Exercises Lessons

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!


πŸ“‹ Table of Contents

Lessons

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

Exercises & Solutions

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

πŸš€ Getting Started

Prerequisites

  • Python 3.10+ β€” Download here
    • ⚠️ During installation, make sure to check "Add Python to PATH"!

How to Use

  1. Clone this repo:

    git clone https://github.com/subimpact/python-fundamentals.git
    cd python-fundamentals
  2. 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
  3. Install Dependencies:

    pip install -r requirements.txt
  4. 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!)

  5. 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

Optional: Check your code style (PEP-8)

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.

Recommended Workflow

  1. πŸ“– Read the lesson file (it's heavily commented β€” just read it like a book!)
  2. ▢️ Run the lesson and verify your output matches EXPECTED_OUTPUTS.md
  3. πŸ§ͺ Try modifying the code to experiment
  4. ✏️ Do the matching exercise and run it to trigger the automated checker
  5. βœ… Check the solution
  6. ➑️ Move to the next lesson

⏱️ Estimated Playthrough Duration

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!

🎯 Who Is This For?

  • 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

πŸ“ Project Structure

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

🀝 Contributing

Found a typo? Have a better example? Want to add more exercises?

  1. Fork this repo
  2. Create a branch: git checkout -b my-improvement
  3. Make your changes
  4. Submit a pull request

All contributions are welcome!


πŸ“œ License

This project is licensed under the MIT License β€” see LICENSE for details.


πŸ™ Acknowledgements

  • 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! πŸπŸš€

Share This Project

Share on X (Twitter) | Share on LinkedIn

About

A clean, highly-structured, and jargon-free guide to mastering core Python fundamentals. Built specifically for absolute beginners.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages