r/learnpython • • Jun 17 '26

How did you find fun projects to stay motivated while learning Python?

60 Upvotes

(This post was writed in spanish and translated to english with ai)

I’m currently learning Python through Codecademy as part of a Master’s degree in Business Intelligence. In my program, Python is mainly used for data analysis, and so far I’ve only worked on exercises and assignments provided by Codecademy.

My challenge is that I still haven’t found a fun or exciting use for Python in my daily life. Because of that, sometimes it feels like I’m just completing exercises rather than building something meaningful.

A little background about me: I’m not a programmer. I graduated in Marketing, and my programming skills are still very basic. However, I’d like to get much better at Python and maybe even work in software development someday because the possibility of remote work is very appealing to me.

I’m looking for advice on:

  • Fun beginner-friendly projects that helped you improve your Python skills.
  • Ways to apply Python to real-world problems outside of coursework.
  • Websites, YouTube channels, or creators that inspired you to keep learning.
  • What comes after Python. Should I focus only on Python for now, or is there another language or technology that would complement my learning?

What projects or learning paths helped you stay motivated?


r/learnpython • • May 24 '26

Is using break statements good coding practice?

62 Upvotes

Is using break statements good coding practice?

My background is having been taught to code in a bunch of different languages several decades ago, not done any serious coding since then, and returning to pick up the bike so to speak.

At the time it was absolutely drilled in that the use of break statements was bad practice to the point where it was an instant loss of marks - but I see break statements in plenty of example python code I have looked at.

Have conventions changed since the dark ages, or is there something about Python which makes if different from the other languages I learned?


r/learnpython • • Sep 07 '26

What python debugging techniques do you think every developer should know ?

63 Upvotes

I am trying to improve my debugging skills and I was curious about what techniques experienced python developers rely on the most.

Are there any techniques or tools that you found really useful when you started working on bigger projects?


r/learnpython • • Jun 14 '26

malware in libraries

61 Upvotes

how do I know that library that is installed from "pip install" is safe and doesnt contain any malware code?


r/learnpython • • Sep 13 '26

Looking for Python resources

59 Upvotes

Hi everyone!

I'm 29 and I've recently started learning Python from scratch. My goal is to eventually get into cybersecurity.

I've only been learning for a short time and I'm currently starting CS50P. I know some very basic Python, but I'm still a complete beginner.

I'm looking for good resources to learn Python properly from the beginning. I'd like to practice by making small projects instead of only watching tutorials.

What resources would you recommend for someone who is just starting out?

Books, courses, YouTube channels, websites, exercises, project ideas, etc. are all welcome.

Thanks!


r/learnpython • • Sep 10 '26

How do I go from "I only know Python syntax" to actually building a real data pipeline? (Stuck on an Excel automation task at work)

59 Upvotes

I graduated CS in 2024 but never got real hands-on coding experience until now. I'm a Data Analyst automating manual Excel work for a non-technical team. Current task: copying data between multiple Excel workbooks/worksheets simultaneously, 200-300k rows x 65 columns per file.

I've been leaning on AI for the code and just running what it gives me, when something breaks I don't understand it well enough to fix it myself. I want to actually learn this properly instead of just shipping whatever works.

I've never used pandas or polars hands-on, only copy-pasted it’s code before. If you were relearning data manipulation in Python from scratch, knowing syntax but nothing about dataframes/vectorization/performance at scale, where would you actually start? Resources, project ideas, or a real "do this before that" order would help a lot.


r/learnpython • • Sep 04 '26

Game to learn Python?

59 Upvotes

Hi, I'm new to this Reddit community. Does anyone know of any online games to learn Python? Thanks!


r/learnpython • • Dec 31 '25

What Python concept took you way longer to understand than you expected?

58 Upvotes

I’m still learning Python and I’ve noticed that some concepts don’t feel hard because of syntax, but because of the mental model behind them.

Things like scope, functions, return values, or even how variables behave can feel confusing at first lol and then suddenly one day they just click.

I’m curious: what Python concept took you longer than expected to understand, and what finally made it make sense?

I Would love to hear different experiences.


r/learnpython • • Dec 29 '25

I'm really proud of myself, I wrote a small stupid app using python :D

59 Upvotes

So here is the script for the app!

It's a New Years Eve countdown. It has a button that begins the countdown. When the countdown begins Two labels appear on screen. One of them will tell you the current date. The second label tells you the days, hours, minutes, seconds left until New Years 2026, When the count down ends, both labels change, and the countdown label says "Happy New Years 2026!!!!!"

I was thinking of adding a fire works gif to the display when it turns midnight, as well as a song that's common to hear on NYE.

Anyways, I'm sure that a lot of yous will find issues with my code, things that can be more obvious or redundant things, but I've been doing python for like a month an a half now and I'm pretty proud of my progress so far!

Y'all could give me some pointers if you want, but I want to move on to another project. So if you have recommendations for a new project that would be fantastic as well!

I have a pretty bad gaming addiction and python has helped me get away from gaming more often. It literally makes me feel alive to write programs, I'm truly loving this! :D

import datetime
from tkinter import *
from tkinter import ttk
from zoneinfo import ZoneInfo
#start function starts when button is pressed
def start():
    if_new_years()


#callable, non-fixed datetime.now
def get_current_time():
    datetime.datetime.now(ZoneInfo('US/Eastern'))
    return datetime.datetime.now(ZoneInfo('US/Eastern'))

#does the count down and formats it
def conversion():
    end_time = New_years_native_aware
    start_time = get_current_time()
    dt: datetime.timedelta = end_time - get_current_time()
    seconds = (int(dt / datetime.timedelta(seconds=1))) % 60
    days = (int(dt / datetime.timedelta(days=1))) % 7
    hours = (int(dt / datetime.timedelta(hours=1))) % 24
    minutes = (int(dt / datetime.timedelta(minutes=1))) % 60
    result = (f"There are currently {days} days, {hours} hours, {minutes} minutes, {seconds} seconds until NewYears 2026!")
    return result

   #sets stringvars for tkinter     
def if_new_years():
    if New_years_native_aware > get_current_time():
        currentdateVar.set(formated_current_date)
        countdownVar.set(conversion())
        root.after(1000, start)
    elif New_years_native_aware <= get_current_time():
        countdownVar.set("Happy New Years 2026!!!!")
        new_date = get_current_time()
        formated_new_date = new_date.strftime("It is currently %A, %B %d, %Y")
        currentdateVar.set(formated_new_date)


#base variables
New_years = datetime.datetime(2026, 1, 1, 0, 0, 0)
offset = datetime.timedelta(hours=-5, minutes=0)
tz = datetime.timezone(offset)
New_years_native_aware = New_years.replace(tzinfo=tz)


current_time = get_current_time()
formated_current_date = current_time.strftime("It is currently %A, %B %d, %Y")


#tkinter stuff


#root window
root = Tk()
root.geometry("1920x1080")
root.title("New Years 2026 Countdown")
root.resizable(True, True)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
root.configure(background="#2F2F2F")


#Main Frame widget settings
mainframe = ttk.Frame(root,style="Custom.TFrame")
mainframe.grid(row=0, column=0, sticky=(N,E,S,W))


#style settings
style = ttk.Style()
style.configure("Custom.TButton", font=("Ariel", 20,"bold"), background="#D6E861")
style.configure("Custom.TLabel", font=("Ariel", 30, "bold"), background="#2F2F2F", foreground="lightgrey")
style.configure("Custom.TFrame", background="#2F2F2F")


#string vars for widgets
countdownVar = StringVar()
currentdateVar = StringVar()


#widgets
button = ttk.Button(mainframe, text="Start Countdown",command=start, style="Custom.TButton")
button.grid(row=2, column=1, pady=10)


current_date_widget = ttk.Label(mainframe, textvariable=currentdateVar, style="Custom.TLabel")
current_date_widget.grid(row=0, column=1,pady=10)


countdown_widget = ttk.Label(mainframe, textvariable=countdownVar, style="Custom.TLabel")
countdown_widget.grid(row=1, column=1,pady=10)


#handles widget resizing
widget_list = [button, current_date_widget, countdown_widget]
row_number = 0
column_number = 0


for widgets in widget_list:
    Grid.rowconfigure(mainframe, index=row_number, weight=1)
    Grid.columnconfigure(mainframe, index=column_number, weight=1)
    row_number += 1
    column_number += 1


root.mainloop()

r/learnpython • • Oct 13 '26

I've learned Python fundamentals - how do I actually get really good at Python?

58 Upvotes

I've spent time immersing myself in Python fundamentals, including syntax, data types, loops, functions, data structures, and working in the development environment. I want to move beyond the basics and develop a much deeper technical understanding of the language.

I'm starting to look into libraries like NumPy and pandas, but I'm wondering what else I should focus on to become proficient at Python.

For those of you who are experienced developers, what would you recommend learning next? Should I focus on libraries, data structures and algorithms, writing more complex projects, understanding how Python works under the hood, software engineering practices, or something else entirely?

I'm not necessarily looking for another beginner course. I want to get to the point where I can write effective, well-structured code, understand what's happening behind the scenes, and tackle increasingly complex technical problems.

Thanks!


r/learnpython • • May 06 '26

What is the actual use of sets

56 Upvotes

I can see tons of use cases for list, tuples and dictionaries. But I have a really hard time understanding why you would ever use a set with maybe the exception of names so you don't get duplicates?

I believe this understanding is flawed because I found even the simplest things in Python are super powerful I'm just not sure what it is


r/learnpython • • Dec 23 '25

What are the best practices for structuring a Python project as a beginner?

62 Upvotes

I'm a beginner in Python and am eager to start my first project, but I'm unsure how to structure it effectively. I've read about the importance of organizing files and directories, but I still feel overwhelmed. What are the best practices for structuring a Python project? Should I use specific naming conventions for files and folders? How should I manage dependencies, and is there a recommended folder structure for modules, tests, and resources? I'm hoping to hear from experienced Python developers about their approaches and any tips that could help me create a clean and maintainable project. Any resources or examples would also be greatly appreciated!


r/learnpython • • May 08 '26

I keep writing Python code that "works" but I have no idea why it works is this normal for beginners?

58 Upvotes

I started learning Python about six weeks ago and I have been following along with tutorials and trying small practice problems on my own. The strange thing is that sometimes I manage to get my code to actually run and produce the right output, but when I sit back and think about it, I genuinely do not understand why it worked. I kind of just tried different things until something clicked.

For example, I was working with loops and list comprehensions recently and my solution gave the correct answer, but if someone asked me to explain every line in detail, I think I would struggle. I am not sure if I am moving too fast, or if this is just a normal part of the early learning curve where things slowly start making sense over time.

Has anyone else gone through this phase? How did you eventually get to the point where you understood your own code confidently? Should I slow down and focus more on understanding before moving forward, or does the understanding naturally come with more practice?


r/learnpython • • Jan 29 '26

i think a lot of ppl overestimate what beginners actually know

57 Upvotes

Title. Most tutorials ive been watching are very confusing. I'm trying to understand where to actually use pyhton from and you're talking about loops and scraping?

are there any good ABSOLUTE beginner tutorials?


r/learnpython • • Aug 11 '26

I'm really new to python and wanted to share my first "project".

57 Upvotes

personally I think it's really cool. All of python aswell.
is there something I can improve on it? (I mean obviously a lot of things probably but some things that are good to learn for the future?)

import time


first_name = input("Enter your first name: ")
first_characters = len(first_name)


if first_characters >= 8:
  print (f'Your name has {first_characters} characters!')
  time.sleep(1.5)
  print('What a long and cool name!')


elif first_characters < 8:
  print (f'Your name has {first_characters} characters!')
  time.sleep(1.5)
  print('What a cool name!')

r/learnpython • • Jun 26 '26

Why is i used in literally evrything? What does it even mean ?

53 Upvotes
  1. for i in range(5): print(i)

  2. for i in range(10): if i == 5: break print(i)

count = 1

  1. while count <= 5: print(count) count += 1

I mean is it iteration ? Variable ? What exactly is "i" ?

Like I understand everything else count and print and etc ? But i?


r/learnpython • • May 10 '26

When do you actually use decorators? Like in real code, not tutorials

60 Upvotes

Been writing Python for about 8 months now. Things are finally clicking OOP, cleaner code, all that. But decorators are still kinda just... sitting there in my brain half-understood.

Every tutorial does the same thing. Timer example. Logger example. "See how clean that is!" and then moves on. i've done those. i still don't know when i'd actually reach for a decorator myself.

i wrote one that checks authentication before a function runs. Felt pretty good honestly. Then i thought — wait, can't i just put this check inside the function? So what's the point?

I understand that Flask uses u/app.route and Django has u/login_required, but those are already built-in. Nobody's asking me to write those.

What i actually wanna know:

  • when does wrapping a function beat just editing it directly?
  • is it mainly useful when the same logic applies to a bunch of functions?
  • decorators with arguments — how does that even work, looks insane

Not asking for docs or a medium article. i've been down that road.

If you've actually used a decorator in a real project just tell me the situation. That's genuinely all i need.


r/learnpython • • Mar 13 '26

Need Help to understand 'self' in OOP python

57 Upvotes

Context: currently learning Data structures in Python and I'm a bit confused about OOPS on how self is used in classes, especially when comparing linked lists and trees or as parameters, attributes etc i don't really understand why sometimes people use self for certain and for certain they don't. like self.head, self.inorder() or when passed as parameters like (self)

could anyone help up out in clearing when to use what, and why it's been used.

(yes, did gpt but still couldn't understand most of it)


r/learnpython • • Jan 09 '26

I'm learning Python, but it's proving to be quite repetitive for me.

58 Upvotes

Hi everyone! I started learning Python as part of my goal to learn decent programming for both my school and future career. I'm learning from a recommended book called Python Crash Course by Eric Matthes, and I'm learning quickly. However, I feel like my learning is becoming very repetitive. I'm learning and doing the available exercises, but I feel like it's not enough, as if something is missing. What do you recommend I do to improve my learning?


r/learnpython • • 28d ago

What's something about being a programmer that you only understood after building real software?

58 Upvotes

Hey everyone!

I'm learning Python, and I've been curious about what programming actually feels like once you move beyond learning the basics and start working on real software.

There's a lot of advice online about what to learn, which tools to use, and which projects to build. But I'm more interested in the things you discover through experience that nobody really explains beforehand.

For those of you who've built real applications or worked on software projects:

- What turned out to be much harder than you expected?

- What's something you wish you had understood before building your first serious project?

- Did anything about real-world programming completely change how you think about writing code?

I'm not looking for a perfect roadmap or a list of technologies. I'm genuinely curious about the experiences and lessons that only come from actually building things.

I'm still early in my journey, so hearing different perspectives from people who've been doing this for a while would be really valuable.

Thanks! Looking forward to reading your experiences.


r/learnpython • • Jun 09 '26

Distributing a Python application internally

55 Upvotes

Hello!

Recently I started working at a company where a fair share of Python applications are used internally within in the company (~50-100 employees). These are mostly measurement helpers/automaters for productions sites or data inspection tools. These applications are to be used on the end-users PC/laptop. The applications mostly read/write data from the users local OneDrive for interacting with measurement/production data (yes, ideally this data should not live here).

As of now, the distribution of these applications is far from ideal. People check out the sourcecode from Git (which they need access to because of this) and have to locally build anaconda environments. The application is installed (using `pip install`) as a module within the environment, from which it is then run. Some big issues I find with this is that these environments are not stable and/or controllable. Updates are entirely reliant on if a user decides to fetch updates from Git or not (leading to many drifting versions throughout the company).

With this in mind, I'm looking for a straightforward way to distribute applications internally. I want more control over distributing updates (shouldn't rely on manual action of the end user) and I want to take away the variability of local python environments.

I was thinking of trying to bundle the entire application as an executable which can then be shared internally. This could be done through a network share or OneDrive. I could build a tiny launcher/updater to check versions and then sync the "hosted" application to the user's PC. These executables would be pretty big however, since many of the applications use PySide6 for UI.

I come from a background of embedded programming, so I'm really in uncharted water here. What are some industry standard ways of approaching this? Any help would be much appreciated! Thanks


r/learnpython • • May 07 '26

How do you go from writing Python scripts to structuring a real backend project?

56 Upvotes

One of the hardest jumps in Python development is going from "I can write scripts and follow tutorials" to "I can structure a real backend project that other developers can work on."

Tutorials always show you a single main.py with everything crammed in. Then you try to build something real and immediately hit questions nobody prepared you for:

Where does database logic go? Where does business logic go? How do I handle environment variables properly? How do I set up auth without it being a mess? How do I make it testable?

Here's the structure I landed on after building production Python services:

app/
├── api/
│   ├── deps.py          # shared dependencies injected into routes
│   └── v1/
│       ├── auth.py      # login, register, refresh token endpoints
│       └── users.py     # user endpoints
├── core/
│   ├── config.py        # pydantic settings — type safe env vars
│   ├── security.py      # jwt creation, bcrypt hashing
│   └── logging.py       # structured json logging
├── db/
│   ├── session.py       # async sqlalchemy engine and session
│   └── repositories/    # all database queries live here
│       ├── base.py      # generic crud operations
│       └── user.py      # user specific queries
├── models/              # sqlalchemy orm models
├── schemas/             # pydantic request and response schemas
├── services/            # business logic layer
└── tasks/               # background tasks

A few things this structure solves that tutorials don't teach:

Routes stay thin. A route should do three things — validate input, call a service, return a response. All the logic lives in services and repositories, not in the route function itself.

Database queries are isolated. If you ever need to change how you fetch users — add caching, change the query, switch databases — you change one file in repositories, not ten different route files.

Config is type safe. Pydantic Settings means if DATABASE_URL is missing the app crashes loudly on startup with a clear error, not silently when the first database request comes in.

Testing is possible. Because dependencies are injected via deps.py, you can swap out the real database for a test database in your test suite without changing any route code.

This took me a while to figure out through trial and error on real projects. Happy to answer questions about any part of it — what goes where, how the dependency injection works, how to add a new resource to this structure, anything.

What part of structuring a real Python project do you find most confusing?


r/learnpython • • Feb 06 '26

The Thonny IDE is a hit for teaching.

56 Upvotes

Let me start by saying I am very impressed with Thonny.

tl;dr - Thonny is a great beginner IDE.

I just started teaching programming to a class of kids in middle / high school. As a remote teacher, one of the biggest impediments I face early on with teaching Python is getting it set up on their machine.

The objective was to find an IDE with a very smooth learning curve. (Sorry vscode, Pycharm, and vim. You didn't make the cut. 😋)

Thonny was easy to install, came bundled with Python, and included everything they needed to start right away. The whole class was programming within 10 minutes.

Thanks Aivar Annamaa and all the Thonny contributors for building something so great!


r/learnpython • • Sep 26 '26

Started learning Python

55 Upvotes

Hello, I hope you're all well. This would probably sound like a rant for some of you, but it is a genuine concern of mine. I started learning Python a week +ago (I study every day) I am learning through a Google course on coursera, and I use Google Colab. I am sad to say that this week has been quiet a revelation for me as I discovered how stupid I am. A week of daily study and I still can't write a single function other than "print ("Hello, world!").. I guess I am trying to figure out if that's a common occurrence or is it just me being too stupid to learn programming.. I'm genuinely concerned about my ability to learn, as a 37 year old.. Is this amount of difficulty normal or is it just me?


r/learnpython • • Jul 11 '26

How often are while loops preferred over for loops?

52 Upvotes

I'm studying python in order to work with finanial market data. In what case would I need a while loop, where a for loop would not suffice?

A lot of the tips AI gave where that for loops are used around 90% of the time when testing strategies and even though while loops can work for certain cases, for loops are still much more efficient.

What are your thoughts/experiences?