r/PythonLearning • • Feb 18 '26

Python Data Structures Visualized

297 Upvotes

Learning data structures in Python gets easier with memory_graph visualizations. Data structures are no longer abstract concepts but concrete, clear and easy to debug.

This Hash_Map demo is a Python implementation similar to 'dict'. The demo visualizes:

  • adding key-value pairs

  • rehashing

  • lookup by key

  • iterating over keys and deleting them

GitHub memory_graph: https://github.com/bterwijn/memory_graph/

More memory_graph examples: r/Python_memory_graph/


r/PythonLearning • • Sep 26 '26 Bravo

Showcase Made my first cool project!!!

Thumbnail
gallery
295 Upvotes

I made a program that calculates exact sunrise and sunset based on latitude and longitude of a specific location.

Here I used this api

I can't get a geocoding api to translate location's name into coordinates.

I had to create a dictionary of a few locations.


r/PythonLearning • • Oct 10 '26

Showcase I got tired of scrolling through big Python files, so I made a mind map for code

287 Upvotes

You know when you're debugging a big file, find the function you need, follow it to another function, then another one, and completely forget where you started?

Yeah. I got tired of that, so I built epy (Extended Python). Though, this is experimented only for python, i will explore other languages if possible.

It's basically a mind map for your code, except the nodes contain actual code instead of just names.

  • Parses Python files using ast and splits them into blocks with exact line numbers.

  • Maps function calls across files, including methods and some class relationships.

  • Has a radial map, a names-only view, a folder explorer, and a synced code pane.

  • Click a function and see what it calls and what calls it. Click a line in the code and it'll select the corresponding block on the map.

The other thing I wanted was to make life easier for small local LLMs. Instead of dumping an entire file into a model and hoping it doesn't rewrite half of it, epy generates a text map and lets you pull individual blocks with their callers and callees. The idea is to give the model the structure first, then only the code it needs.

I tested it on one of my projects: 33k lines, 134 files, ~1,100 call links, built in about 1.5 seconds.

It's currently a single Python file with no external dependencies.

python epy.py view some_file.py
python epy.py map .
python epy.py show . MyClass.run

It's still a personal tool, not some polished production-ready package. The call graph is static and best-effort, and I haven't formally benchmarked the LLM side yet.

The idea originally came from the execution model of a small language I'm building (EPL). Eventually, I'd like to add Tree-sitter so it can support other languages too.

Repo: https://github.com/phoenix2610/Extended_Programming.git

Would love some feedback, especially if you try it on a ridiculously large Python file or feed the generated map to a small local model. Curious to see where it breaks. 😅

And if anyone is wondering, yeah I am using ARCH Linux and the background bit faded is just a keybinder for opacity...


r/PythonLearning • • May 02 '25

I’ve written a Python book for beginners — happy to share a free copy if you’re learning

287 Upvotes

Hi all,

I’ve been working on a beginner-focused Python book called Python Simplified: A Crash Course in Practical Programming for Beginners. It’s designed for people who are brand new to Python and want a clear, structured way to learn the basics — step by step, with no fluff or jargon.

Each chapter includes:
✅ A walkthrough of one core concept
✅ Exercises to test yourself
✅ Fully worked solutions
✅ GitHub code to follow along with

I’m currently wrapping up final edits and getting ready for release at the end of May — so I’m offering free advance copies to anyone learning Python who’s happy to take a look and maybe share feedback or a review later.

If that sounds useful, feel free to comment or DM me — I’d be glad to send it over.

Thanks to the mods for letting me share this — and good luck to everyone learning Python! Happy to answer any beginner questions in the thread too.


r/PythonLearning • • Feb 20 '26

Python Mutability and Rebinding

Post image
285 Upvotes

An exercise to help build the right mental model for Python data. The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening:

It's instructive to compare with this earlier exercise.


r/PythonLearning • • Sep 30 '25

Day 2 of 100 of learning Python

Thumbnail
gallery
284 Upvotes

Day 2 of #100DaysOfCode (Python) 🐍 Built a simple ATM simulation 💳 – Login system (username + PIN) – Check balance – Deposit money – Withdraw money – Exit option

Still basic, but it feels like building a real-world app. What do you think? Built to continue to loop until user choose choice 4. Rate my ATM!


r/PythonLearning • • Aug 11 '26

Showcase I wrote my first ever Python program!

Thumbnail
gallery
283 Upvotes

So upon recommendations from people here I started watching Code With Mosh's Python tutorial (The 2 hour one) around 3 days ago. I finished it yesterday. Didn't really wanted to get stuck in tutorial hell so I simply asked AI to give me a problem statement (only the problem statement and not the code or logic) to work on. So here am I with my first ever program. It's nothing much and even I could see areas for improvement right now but I am proud.

On to the more complex topics. I appreciate the help and support from the community!


r/PythonLearning • • Jul 21 '26

Discussion I've taught Python to absolute beginners for years. Here's the 16-week roadmap I use to take students from zero to building REST APIs - no tutorial hell.

282 Upvotes

The number one mistake I see beginner Python learners make is spending months on YouTube tutorials and then completely freezing up when they open a blank .py file to code on their own. It's called Tutorial Hell, and it's a real problem.

The difference isn't talent; it's having a structured roadmap that forces you to build things, not just watch things.

Here is the exact 4-phase breakdown I follow:

Phase 1: Foundations & Core Logic (Weeks 1–4)

Focus: Get comfortable with how Python actually executes code, not just what it does.

  • Week 1: Python 3.12+ setup, VS Code with Black auto-formatter, terminal basics, REPL vs script files

  • Week 2: Core data types (int, float, str, bool, None), dynamic typing, type casting, truthiness, match/case

  • Week 3: if/elif/else, for and while loops, enumerate(), zip(), break/continue, and the for-else pattern

  • Week 4: Functions, *args/**kwargs, the mutable default argument trap, LEGB scope rule

Hands-on drills: Terminal guessing game with random.randint(), a modular unit converter CLI with input validation.

Phase 2: Data Structures, Files & Error Handling (Weeks 5–8)

  • Week 5: Lists, Tuples, Dicts, Sets, O(1) vs O(n) lookup, list/dict/set comprehensions

  • Week 6: f-string format specifiers, string cleaning methods, regex with the re module

  • Week 7: try/except/else/finally, custom exception classes, defensive coding patterns

  • Week 8: Context managers, pathlib, csv.DictReader, json.load/dump

Capstone drill: A persistent JSON inventory manager with full CRUD from the command line.

Phase 3: OOP, Git & REST APIs (Weeks 9–12)

  • Weeks 9–10: Classes, __init__, dunder methods, inheritance, super(), @ property decorators

  • Week 11: Virtual environments, requirements.txt, professional project structure, Git workflow

  • Week 12: HTTP protocol, the requests library, API authentication, generators with yield

Capstone drill: A banking system simulator with an account hierarchy, and a live weather CLI hitting OpenWeatherMap.

Phase 4: Portfolio Projects (Weeks 13–16)

This is where you build three production-grade projects for your GitHub:

  1. CLI Log Intelligence Tool — argparse + pathlib + regex to parse Nginx logs and generate JSON/CSV reports

  2. API Harvester & Alert Bot — polls a public API, stores historical data in SQLite, fires Discord webhooks on conditions

  3. REST API with FastAPI — full CRUD backend with Pydantic validation, SQLite persistence, and a pytest test suite

The 3 Rules That Make This Work

1. The 70/30 Rule: 30% reading, 70% typing code by hand. Never copy-paste from examples. Muscle memory is built through repetition.

2. The 30-Minute Debug Rule: Before searching for the answer or asking for help, spend 30 minutes reading the traceback bottom-up, checking docs, and using print(). You will solve 80% of problems this way.

3. Ship Every Week: Every Friday, push code to GitHub; even if it's broken. Progress beats perfection.

Happy to answer questions about any specific phase or topic. What stage are you at right now?


r/PythonLearning • • Aug 05 '26

Teaching Python the right way

281 Upvotes

Programming courses often focus heavily on understanding code, while paying far less attention to understanding the program state. But code does not exist in isolation. Its main goal is to change the program state, before ultimately producing some output.

To develop an accurate mental model of program execution, students need to understand both:

  • the instructions being executed

  • the values, references, and data structures those instructions create and modify

Reading code alone does not always reveal how the program state changes during execution. That is why I created 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵: a tool that visualizes the state of a Python program as it changes, step by step.

It can help explain a wide range of introductory Python topics. Here are just a few examples:

Instead of reconstructing the program state from print statements, students can now watch it change as each line executes. This makes unfamiliar concepts easier to understand and bugs easier to fix.

Help your students learn Python programming more thoroughly and easily.

See: more examples


r/PythonLearning • • Mar 02 '26 Bravo

Stanford's Free Code in Place Program is live and accepting applications!

277 Upvotes

Hi PythonLearning community, as the post title states, Code in Place is now accepting applications for our 2026 program! Learn or teach intro programming with us this spring 👉 codeinplace.stanford.edu.

Code in Place is our free, virtual, guided program for anyone around the world interested in learning to code.

  • Free intro Python course from Stanford University

  • Made for beginners with no programming experience

  • Teacher–guided learning with weekly live sessions

  • Flexible virtual schedule: 7 hours/week for 6 weeks

  • Build problem-solving skills and real portfolio projects

  • Join a global community of 20,000+ students and teachers

  • Open to all ages and backgrounds

Join us in growing our global community of learners and mentors. Class begins April 20, 2026. See you there :)

And thank you(!) to the r/PythonLearning mods for allowing us to post this awesome opportunity.


r/PythonLearning • • May 22 '26

Common 𝗹𝗶𝘀𝘁 operations in Python.

Post image
275 Upvotes

r/PythonLearning • • Jun 07 '26

Practicing class and object by building a banking system.

Thumbnail
gallery
274 Upvotes

I was learning class and object concepts. And built a basic banking system. I was always interested in how banking system works. After doing this basic thing, I am feeling confident in learning more to give it a advanced look.

I'd love to receive any feedback, advice, and suggestions, so feel free to share.


r/PythonLearning • • Apr 30 '26

Practicing OOPs

Post image
272 Upvotes

Coding and experimenting with oops, tell something that can enhance my learning in practice and can challenge me to think .

things i have to cover.

class
Objects
constructor
__str__
instance,class,static methods
decorator
Encapsulation
private
protected
getter
setter
property
Inheritance
single & multiple inheritance
Polymorphism
overloading
overriding
Abstraction
ABC
abstractmethod

am i missing anything ?


r/PythonLearning • • Feb 15 '25

Guys. Is the free Python course from CS50 worth it?

Post image
271 Upvotes

r/PythonLearning • • Jul 11 '26

Showcase I am 14 and this is the game i made... Link below:

268 Upvotes

https://github.com/coding-arnav66/Arnav-Python-Projects2/blob/main/shooter.py

---------------------------------------

All the suggestions, criticism and ideas are welcome...


r/PythonLearning • • Mar 17 '26

Automatically Visualize your Data in your IDE

268 Upvotes

Automatic data structure visualization in your IDE using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵:


r/PythonLearning • • Dec 15 '24

I began learning python & i made this project 2 weeks later

Post image
260 Upvotes

r/PythonLearning • • Aug 19 '26

Showcase Made my first Python project!

Post image
256 Upvotes

This is my first actual real project, what started as a simple python exercise to learn about dictionaries in python, ended up into a huge learning project for me. Im a beginner in python, used to code but just basic input print codes… some are genuinely stupid.

I took on the challenge to self educate my self python. And this is where i currently am! Im proud of what i did and it will surely expand!

Here the repo with the project. Feel free to check it out!
https://github.com/Stonyax97/MiniGameStore

It has everything from the first ever iteration (which was it self modified a bit since from the very original but it’s still very simple)
I would love for anyone to recommend ideas to add, criticism too. Or anything you think i should learn next for that would be genuinely useful!


r/PythonLearning • • Apr 12 '26 Popcorn

I work for this amusement park, can someone help me debug this?

Post image
248 Upvotes

I dont really have much time to fix this, I think I already wrote 2 million lines of code I'm so tired.


r/PythonLearning • • Sep 18 '25

Why??

Post image
244 Upvotes

r/PythonLearning • • Aug 22 '25

Practicing what I learnt in Python

Post image
244 Upvotes

I have been learning Python on my own for the past few months using the book titled ‘Python Crash Course’, it’s a book I am really enjoying.

So I want to ask few questions as a beginner: Is this a good project as a beginner? Also how can I improve this or take it further? Any resources for me to do more practices as a beginner?


r/PythonLearning • • Mar 30 '26

if and else statement confusion.

Post image
243 Upvotes

Why is none being printed on the first two cases, the A and B ones. The else statement shouldn't be triggered if I enter a value of say 6.

value = int(input('Enter a number: '))

if value > 5 and value <= 8:

print('A')

if value >=14 and value <=19:

print('B')

if value > 30:

print('C')

else:

print('none')


r/PythonLearning • • Sep 13 '26 Regret

Showcase The Bank Project

Post image
242 Upvotes

r/PythonLearning • • Mar 12 '26

Help Request I’m new and so confused😓

Post image
242 Upvotes

I just started learning the basics and couldn’t figure this out fully so I asked google. Now the code works but I think it wants me to do it in a different format and I don’t know how. Any ideas are appreciated.