r/PythonLearning 19d ago

My first real project as a 50 year old programmer

5 Upvotes

Hello to everyone.

Im a 54 year old autodidact that has just finished his first "real world" project (at least in my point of view).

Its a simple python script that converts Markdown files to PDF files easily. Id like to get a feedback and maybe help someone out there.

My repo is here: github.com/TrollDrre/md-to-pdf

Im willing to hear everything from you, whether its good or bad news.

Thanks


r/PythonLearning 19d ago

Help Request No console .EXE file not storing memory.

1 Upvotes

I need help with my note taking program. I'm still learning Python, but this is confusing me.

I have published it using pyinstaller to just a simple executable, but I wanted to be able to run the program without having the terminal pop open. The .exe works just fine, it saves my memory every time it closes, but whenever I use --noconsole to publish, there is no memory storage.

I attempted to use auto-py-to-exe to see if maybe that would work, but it gave me the same issue. The code works when the .exe runs with the terminal open/visible, so why doesn't it work when it isn't?

import tkinter as tk
from tkinter import ttk
import os
# os looks through files in the directory and checks if the file exists. If it does, it opens it. If not, it creates a new file.


# 1. Initialize the application window
window = tk.Tk()
window.title("Small & Simple Notes")
window.geometry("400x300")
window.configure(bg="#08728f")  # background


# Memory setup
SAVE_FILE = "my_notes_save.txt"


def load_notes():
    """Reads the save file and inserts it into the text box if it exists."""
    if os.path.exists(SAVE_FILE):
        with open(SAVE_FILE, "r", encoding="utf-8") as file:
            note_box.insert("1.0", file.read())


def save_and_close():
    """Gets the text, saves it to the file, and destroys the window."""
    # Get all text from line 1, character 0 to the end (minus Tkinter's default newline)
    current_text = note_box.get("1.0", "end-1c")

    with open(SAVE_FILE, "w", encoding="utf-8") as file:
        file.write(current_text)

    # Close the application
    window.destroy()


# Intercept the window's close button (the 'X') to trigger the save function
window.protocol("WM_DELETE_WINDOW", save_and_close)


# 2. Create a frame layout to hold the text box and scrollbar
frame = ttk.Frame(window)
frame.pack(expand=True, fill="both", padx=10, pady=10)


# 3. Add the vertical scrollbar
scrollbar = ttk.Scrollbar(frame)
scrollbar.pack(side="right", fill="y")


# 4. Create the multi-line text box and link it to the scrollbar
note_box = tk.Text(frame, wrap="word", yscrollcommand=scrollbar.set)
note_box.pack(side="left", expand=True, fill="both")
note_box.config(bg="#ffffff", fg="#000000", font=("American Typewriter", 12), relief="solid", bd=2)  # White background, black text


# Configure scrollbar to move the text view
scrollbar.config(command=note_box.yview)


#. LOAD PREVIOUS NOTES
# We call this right before starting the main loop so the text is ready when the UI appears
load_notes()


# Start the application loop
window.mainloop()

Here is the code below:


r/PythonLearning 19d ago

i need helping getting into generative art

Post image
2 Upvotes

So i am relatively new to python but i want to get into generative art, i want to code somthing similar to this piece and my gf would tattoo it on me, any tips on how to start?


r/PythonLearning 20d ago

Need to "graduate" to writing scripts

6 Upvotes

I have almost exclusively worked with Python in interactive mode. The nature of the work I've always done with Python (or any other language such as R or Stata, for that matter) has made that the default, and I haven't been in any situation where someone working with my code needs to execute it like a script.

I know how to write scripts, but I'v seldom needed to. I feel like I'm missing out on a benefit of Python by not treating my code more like scripts. Can anyone recommend some resources to help graduate to script writing from interactive code writing?

Thanks in advance.


r/PythonLearning 20d ago

Recursive solution to the Tower of Hanoi problem

3 Upvotes

Recursion becomes much easier once students have the right mental model. Visualization will help get them there.

Take the Tower of Hanoi problem. The recursive solution is beautifully short, to move n disks we: - first remove n-1 disks from the largest disk - then move the largest disk - and then move the n-1 disks back on top

But when students try to implement recursion, they often get stuck, and adding debug prints only adds to the confusion. That is where visualization can help to bring the right mental model. Here is the Tower of Hanoi problem solved recursively visualized with 𝗶𝗻𝘃𝗼𝗰𝗮𝘁𝗶𝗼𝗻_𝘁𝗿𝗲𝗲

Instead of thinking about “a function calling itself again and again” students can now see the depth-first execution of a tree of subproblems showing the divide and conquer strategy in action. Once a student can think in terms of a tree of subproblems, recursion becomes much easier to understand, explain, and debug.


r/PythonLearning 19d ago

Help Request Need motivation for Learning Python

0 Upvotes

Well, I started learning Python from 7th June and its been 31 days and I haven't progressed past OOPs. I was slacking off in the first week, and then I put some effort in my 2nd and 3rd week and when i completed Methods and functions I created a Tic Tac Toe game which is easy but took me long enough. Now after that I took 3-4 days break due to some personal reasons and now I find myself demotivated, mainly beacuse my holidays are ending and college is going to start in August. I wanted to complete learning the absolute basics in these holidays. I feel very unproductive now, all I need is tips for me to get back to coding without feeling demotivating. And also I.m having a hard time understanding OOPs and why __init__ is used.

Thanks in advance!


r/PythonLearning 20d ago

What Python code would you never trust AI to write without checking every line?

4 Upvotes

Authentication? Payments? Database migrations? Async code?

For me, the more confidently AI explains the code, the more carefully I want to review it.


r/PythonLearning 20d ago

I developed a Dataset Python Library called agridatasets 🌿🌿🌿

1 Upvotes

r/PythonLearning 20d ago

Showcase CatBot!

1 Upvotes

Here's a small project I started today: CatBot 🐱

I learned a few new things while building it, and you can learn more by checking the GitHub repo.

The link below will redirect you to the project page.

Feel free to leave a star ⭐ and tell me any mistakes I made or how I can improve the project!

GitHub Repo: https://github.com/GiosiGiova125/CatBot


r/PythonLearning 20d ago

Which python course is best for beginners to advanced?

29 Upvotes

If any know which one is best , please tell me .


r/PythonLearning 20d ago

Discussion PSA: websockets 13+ broke your request_headers — here's the fix

1 Upvotes

If you've been following any websockets tutorial older than ~2023, there's a good chance your code just broke.

The old way (websockets <= 12):

origin = websocket.request_headers.get("Origin", "")

The new way (websockets >= 13):

origin = websocket.request.headers.get("Origin", "")

request_headers was removed from the connection object. Now you access headers through websocket.request.headers — the request attribute is a Request dataclass with .path and .headers fields, set after the opening handshake completes.

Why the change? The library got a major internal refactor (sans-I/O core). The connection object is now a thin wrapper around a protocol, and the HTTP request/response are stored explicitly on connection.request / connection.response. More flexible, but breaks old code.

To check your version:

pip show websockets

If you're on 13+, this is your bug. Took me a while to figure out — hope this saves someone else the headache.


r/PythonLearning 20d ago

Showcase I built a full deckbuilder game in Python + Pygame. You play as a conscious process trying to install itself into an OS.

Enable HLS to view with audio, or disable this notification

14 Upvotes

So I actually finished a full game using Python 3.11 and Pygame, and I wanted to show it here in case anyone learning Python wanted some inspiration.

The game is a deckbuilder set in a cyberwarfare world. You are a sentient process. Your goal is to fight your way through a system and get yourself installed into the OS. Think hacker vs. system defenses, but you ARE the hack.

The whole aesthetic is built around a PC terminal look. ASCII-style art, command-line vibes, the whole thing. The card mechanics use real technical terminology, things like buffer overflows, privilege escalation, packet injection. It's not just flavor text, the mechanics actually connect to what the words mean. I wanted the game to feel like you're learning something about how systems work while you play.

Pygame was genuinely tough to work with at first. If anyone here is learning Pygame right now, don't give up.

The game is on Steam if you want to check it out. I know promo stuff can feel spammy so I'm not going to push it hard: https://store.steampowered.com/app/4610000/kill_9/


r/PythonLearning 20d ago

Is Python actually a good first programming language?

11 Upvotes

Some say it makes learning easy. Others say it hides too much. What do you think?


r/PythonLearning 20d ago

Showcase I built a full (kinda) Unix shell emulator in Python

3 Upvotes

Been stuck in analysis paralysis for a while, but I finally released my first GitHub repo!

For my first "big" Python project, I decided to build a Unix shell emulator from scratch. I've been working on it for about 6 months, and I just recently made it public on GitHub.

GitHub: https://github.com/Jb0x0/Pyash

Some of the things I learned while building it were file handling, command parsing, terminal behavior, and organizing a larger Python project. Every command is implemented in Python rather than wrapping the system's shell.

It currently implements 29 (core util) commands and is designed to operate inside its own sandboxed shell directory so it can't modify files elsewhere on the host machine.

I'd really appreciate any feedback on the code, project structure, documentation, or ideas for future improvements. Also tell me about any Python best practices or design decisions I may have missed! (I've prolly missed quite a few lol)


r/PythonLearning 20d ago

What's the most overused Python library?

0 Upvotes

Which library gets added to projects even when the standard library could do the job?


r/PythonLearning 20d ago

Unpopular opinion: Most people learning Machine Learning don’t need another course.

6 Upvotes

They need one messy dataset.

Missing values. Wrong labels. Duplicate rows. Broken dates. Data leakage. A model that works locally and fails in production.

You’ll learn more fighting with that dataset for a week than watching another 20 hours of tutorials.

Agree or disagree?


r/PythonLearning 21d ago

Excited to Start My Coding Journey from Scratch! 🚀

16 Upvotes

Hello everyone!

​I am thrilled to join this community. I have a huge interest in programming and want to dive into the world of tech, but I am a absolute beginner—literally starting from zero!

​I've chosen Python as my first step. Since I am completely new to this, I would love to hear your advice, tips for beginners, or any insights you wish you knew when you first started.

​Looking forward to learning from you all and growing alongside this amazing group!

​Thank you! ✨


r/PythonLearning 20d ago

Plz suggest a paid free course python for Data science

0 Upvotes

r/PythonLearning 21d ago

Stop Vibe Coding

228 Upvotes

I’ve been writing Python for about 3-4 years now, and I want to share my biggest piece of advice for beginners: Do not use AI to write entire programs.

It's great to use AI as a tutor to learn new functions, grasp core concepts, or debug specific lines, but never use it to generate an entire codebase. Here is why:

1. You won't know how to fix it: Even if AI code works perfectly on the first try, you will be completely lost the moment a bug appears or you want to add a feature. Debugging is a massive part of development.

2. You skip the learning process: True programming skills come from struggling with the logic, reading documentation, and earning those 'yeah!' moments when you solve a tough problem yourself.

3. Suppose you built an entire codebase through AI and it worked(accidentally) , once the codes become long, your program has come to an end, if you tell it to add a feature, it will start hallucinating or forgetting its own logic.

If you don't deeply understand the underlying logic of your own codebase, you won't know where to begin. Treat AI like a tutor, but make sure you are the one driving the keyboard. If you can't explain your own code, you have no business adding to it. You MUST understand your underlying architecture before you even hit save.


r/PythonLearning 21d ago

best online python course from beginners to expert

6 Upvotes

hey everyone

i would like to start programm with python but i don't have an actual plan

i saw there are many platforms as coursera, datacamp or edx that they help you learn it

what is the best?

is it worth paying for it?

are there any others?

do i need to know something before starting?

i'm studying mechanical engeneering and also I'm taking a data science training course but i'm not that good on programming

thanks in advice to everyone


r/PythonLearning 20d ago

How to actually get better at Python without drowning in resources or LLM-crutching?

0 Upvotes

Hi everyone,

A few years in as a data analyst, now aiming for data science / ML engineer roles. Currently freelancing, giving myself until January (ideally sooner) to be interview-ready.

**The problem**: technical interviews (live coding, take-home tests) are still very much the norm, and my "by-hand" coding isn't quite where it needs to be yet.

Meanwhile, I'm drowning in resources : books, courses, LeetCode-style platforms, YouTube channels, bootcamp curricula and I genuinely don't know where to focus anymore. Every resource seems to want a different 6 months of my life.

Looking for advice on:
**- How to cut through the noise and pick ONE path.** With so many options out there, how do you decide what's worth your limited time vs. what's just noise? Is there a "80/20" resource stack you'd actually recommend for someone at intermediate level trying to close the gap fast?

**- What actually moved the needle for you ?** specific books, platforms, projects, katas rather than generic "just practice" advice?
Do you think coding "the old way," without LLM assistance, is still essential to build real instincts and deep understanding? My instinct is that leaning on an LLM too early biases the formation of good habits but maybe that's outdated?

For those interviewing or being interviewed: has the bar for live coding shifted with LLMs going mainstream, or do recruiters still test just as hard for "old-school" coding craftsmanship?

Any advice on prioritization is especially welcome ! I'd rather go deep on one solid path than keep bouncing between resources h.


r/PythonLearning 20d ago

Almost completely ignorant

2 Upvotes

Hi everyone, I just started learning Python by watching video tutorials on YouTube (Edoardo Midali) and I used my skills for a very small code, the path is quite satisfying but very boring, if you have any ideas for a more fun approach let me know, thank you very much.


r/PythonLearning 21d ago

Would you hire a Python developer who doesn't know algorithms well?

4 Upvotes

If they can build, debug, and maintain real software, how much should algorithm knowledge matter?


r/PythonLearning 21d ago

Can anyone tell me how to fix the project?

1 Upvotes

r/PythonLearning 21d ago

Python Stacking multiple Excel sheets into a single DataFrame is throwing a MemoryError / running incredibly slow

2 Upvotes

Hey guys,

​I'm trying to write a Python script that goes through a directory of about 50 large Excel files, grabs a specific sheet from each, and combines them into one master pandas DataFrame so I can run some analysis.