Learning Python by making a Metro Map Generator.

Aug 2, 2025 10:59 AM

abbiistabbii

Views

25298

Likes

429

Dislikes

8

https://github.com/abbiistabbii/pythonscripts/blob/main/metromapmaker.py

Playing around with Turtle has taught me more Python than any other programming tutorial ever has.

Metro map generator on github. I take no responsibility if it accidentally creates a Swastika, it's procedurally generated and random.

coding

programming

python

technology

I think we learned something similar in the 80s in school

3 days ago | Likes 1 Dislikes 0

Nice!
I've been meaning to learn some Python for years... and I just lack the motivation :(
šŸ

3 days ago | Likes 7 Dislikes 0

i taught myself python a few years ago to replace statistics programs and microsoft power BI. Never looked back.

3 days ago | Likes 1 Dislikes 0

3 days ago | Likes 1 Dislikes 0

It's the memey stabey gal! Learning python too!

3 days ago | Likes 1 Dislikes 0

That's awesome! I don't know how to do that!

3 days ago | Likes 43 Dislikes 1

"Python Turtle is a beginner-friendly library that offers an interactive environment for learning and creating graphics. It provides a canvas on which the turtle can move and draw, allowing users to visualize the execution of their code in real time."

3 days ago | Likes 1 Dislikes 0

3 days ago | Likes 12 Dislikes 2

Attaching your learning to something you're passionate about is a great way to advance technically. I'm a former tech lead of 7 years and a current consultant. My biggest advancements in knowledge have all been driven by hobby projects I used languages and frameworks to build which I later used at work.

3 days ago | Likes 2 Dislikes 0

your cartesian plane needs some viagra

3 days ago | Likes 2 Dislikes 0

turtledicks

3 days ago | Likes 2 Dislikes 0

Iirc MIT has some free courses on python. I haven’t taken them so I can’t vouch, but it’s MIT so I can’t imagine the quality is bad…

1 day ago | Likes 1 Dislikes 0

That's a good start. I hesitate to recommend this, but I'd throw that into Claude AI and ask it to clean up the code, then have it explain why it did the things it did. I hesitate because AI absolutely makes mistakes and I don't want you to learn from bad examples, but I offer it up because it can provide more information than I can in this box. There are practices that you'll want to adopt in order to make your code more readable (this will help you in the future, trust) and reusable.

3 days ago | Likes 3 Dislikes 2

Some things like descriptive variable and function names will be critical in helping you understand what the code does/returns by reading a line rather than digging into the func to try to parse what it does. Putting all your constants and global variables (I'd avoid using global variables) up at the top will help with organization and locating them. I'd also recommend adopting the convention of naming all constants WITH_ALL_CAPS so they're immediately identifiable as a constant.

3 days ago | Likes 2 Dislikes 1

Global variables can make life easier, but they can also lead to chaos. I'm not a python dev, so I'm not sure how often globals are used, but in my own development I avoid them like the plague. A good dev may be able to properly coordinate their code and avoid bugs that can be common with globals, but it takes just one team member who doesn't understand the code/timings to mess everything up. Or one brainfart on your own part. Then it becomes a nightmare to track down and fix.

3 days ago | Likes 3 Dislikes 0

I used to teach programming. This is EXACTLY what I’d recommend.

Every student makes their own subtle mistakes that are likely to become bad habits, and frankly there’s never enough teachers to go around.

Sure, AI has problems, but it’s good enough to be at ā€œjunior programmerā€ level… and that’s good enough that a ā€œbeginner programmerā€ can learn from it.

3 days ago | Likes 2 Dislikes 1

I'd counter this by saying no novice should ever use Claude AI, or copilot, or any other form of AI to write or rewrite their code until they have more fully learned how the language works.

They can be a useful tool, but like any advanced tool, they require more than foundational knowledge to apply them correctly.

2 days ago | Likes 2 Dislikes 1

You can just ask it to explain. That’s one of the best uses for AI LLMs there is.

It is a teacher with expert knowledge in a subject, no time limit, and infinite patience for a student’s needs. You can ask it to explain multiple ways, create analogies, and often even provide references for further learning.

When I used to teach coding, the limiting factor was usually the teacher’s ability to communicate their knowledge within the available time. Modern AI drastically reduces that restriction.

2 days ago | Likes 1 Dislikes 0

To anyone downvoting me, know that I'm not belittling or negating what @OP has accomplished; I think it's great that they're learning and this is a good start. I also know that if I were in their place and still learning, I'd appreciate feedback from an experienced dev so that I could better my craft.

3 days ago | Likes 2 Dislikes 1

i think the downvotes are probably because of the words "I'd throw that into Claude AI" more than anything else.

3 days ago | Likes 2 Dislikes 0

As long as you don't end up as Charles Tyson Yerkes, and then have a youtuber moan about you whenever talking about the UERL, but still, good work.

3 days ago | Likes 1 Dislikes 0

Ah, a Jago Hazzard Subscriber.

2 days ago | Likes 2 Dislikes 0

The underground was the bane of my life for 3 years when I lived in London, moved back up North, hate the trains, love the lack of insanity here

2 days ago | Likes 1 Dislikes 0

Ah, idk which part of the north you're at but if you need a metro fix, there's always the Metrolink or the Tyne and Wear Metro.

1 day ago | Likes 2 Dislikes 0

I grew up with Metrolink so I'm well aware how good it is, just a smidge outside of it's range now (20-30 minute bus)

1 day ago | Likes 1 Dislikes 0

Accidental swastika are pretty common in any graphical medium that makes use of straight lines and right angles. Also, this is pretty awesome. Does it have a function to erase blocks and then build new ones in the space to simulate how cities evolve over time?

3 days ago | Likes 11 Dislikes 0

nah, it's pretty simple.

2 days ago | Likes 5 Dislikes 0

@OP what ever your local transit agency might offer an API that you could use to generate live bus/train stop info (as a json file) for use, also looking into the use of geopy and tkintermapview libraries for a map GUI and and translating GPS coords into locations (I can provide code and screenshots when I have time).

3 days ago | Likes 1 Dislikes 0

I have been thinking about making a script that plays a train whistle 10 mins before a train arrives at my local station.

2 days ago | Likes 2 Dislikes 0

What got me to learn python finally was several Minecraft mods that are just too much fun to play with. I've automated so many farms this way, and it's such a delight watching them do what i programmed

3 days ago | Likes 34 Dislikes 0

Huh? Since when can Minecraft integrate python mods? Every mod I've seen for it is in Java, every mod I've written for it (or any game) has been in the game's native language, or straight up hex edits/file-replacements rather than mods that are "loaded", when we made "Halo 2" before it came out by modding Halo 1, it was 100% hex edits. Where can I find info on Minecraft mods written in Python?

3 days ago | Likes 11 Dislikes 0

There is a mod called Computer Craft, and another one called Computer Craft Tweaked, that one runs on LUA but there is absolutely a way to get it to use python instead. Plus there is another mod called minescript that allows you to control your character using python as well.

3 days ago | Likes 7 Dislikes 0

Thank you for this, sweet fox ā¤ļø

3 days ago | Likes 2 Dislikes 0

:3 you're most welcome! I kinda wanna put together a group of people just for making these scripts together, so if you ever wanna talk programming, let me know!

3 days ago | Likes 2 Dislikes 0

šŸ’• Thanks!! I'm a sloppy hobbyist but when I sharpen up I'd love to!

2 days ago | Likes 2 Dislikes 0

I know all this because I do use all of them. I love programming a lot and it happens to be one of my biggest hyper focuses. I understand I better than I understand people

3 days ago | Likes 6 Dislikes 0

I love programming too but struggle to focus on it. No idea where to start, tutorials leave me with more questions and I struggle with people on reddit and forums that are rude when questions are asked. And higher education for it costs so much money, self teaching is the only way. You guys are magicians to me.

2 days ago | Likes 3 Dislikes 0

I would love to help!

2 days ago | Likes 2 Dislikes 0

Idk what the OP is specifically referring to, but mcpi might be among the relevant things here https://github.com/martinohanlon/mcpi. Aside from minecraft, scripting a game with Lua or a similar language is very common, and modding capabilities are often exposed via those means rather than requiring anything in a game's native language.

3 days ago | Likes 2 Dislikes 0

Aye, I mentioned using approved-extensions to existing mods here: /gallery/UDelLcZ/comment/2469296083

3 days ago | Likes 1 Dislikes 0

(*apart from the meshes and animations, but even when it came to meshes they were edits to existing stuff because of the weird way it validated stuff, for example we made Zanzibar out of the polygons in "The Library" so the game saw it as a "valid" level to load)

3 days ago | Likes 5 Dislikes 0

I think dude might be referring to some python scripts that alter the server-side behavior? I don’t know much about this so I might be talking out of my ass, I just remember playing MC with friends on a server they assembled that had all the block drops randomised with a python script.

3 days ago | Likes 3 Dislikes 0

The way Minecraft works, it's both a client and a server. The "server" version is basically just 1/2 of the normal game. The same mod system works on both. On the server-specific side there's unique stuff like bukkit and spigot, but even that's all java. At best I can see a mod written in Java that allows the player to add their own jython or lua code for that sort of thing, but that's adding approved-extensions to an existing mod, not really modding it yourself.

3 days ago | Likes 1 Dislikes 0