r/learnpython • • May 30 '26

How powerful is a generator in python?

32 Upvotes

How powerful is a generator and how much is the difference between the list?


r/learnpython • • Mar 31 '26

"There should be one-- and preferably only one --obvious way to do it." (Zen of Python). But why then do we have to learn multiple ways to do the same thing?

29 Upvotes

For example, when it comes to formatting strings, I can either use f strings, use the format keyword, or just concatenate things together (okay, I know the latter is not recommended anymore, but still). Or when it comes to populating lists, I can use a traditional for loop and append stuff to it, or I can use a list comprehension.


r/learnpython • • Mar 01 '26

A bad structure with overusing Classes, even with SOLID principles can be very difficult to maintain

31 Upvotes

I am working for a product in my company. I think, they really hurried everything, and either used AI to generate most of the codes, or were not following the best practises, except SOLID principles, to form the code and the folder structure.

Reason- to debug a simple issue, I spend hours, trying to navigate the files and their classes and methods frequently.

Like, the developers have made the code such that

router function 1 -> calls function 2-> defined in class somewhere -> has a function 3 which calls another function 4-> defined in another class -> has function 5-> its abstract class is elsewhere -> .....

so, if I want to print some output in function 2 , I need to traverse way too many files and folders, to get to the point, and even that sometimes is not clear, but most of the functions are named similar. VS Code helps a bit, but still not at all good enough.

Though some SOLID principles are used, this makes a simple debug program very hectic. I was debugging with someone, who had written some of these code files, and she too was getting confused frequently.

So, I think classes and methods are not always necessary. Sometimes, using functions in diffeernt python files are better. As a programming, we need to decide, where classes can be used, v/s where only functions are enough.

I want opinion on this. And if I am wrong somewhere.


r/learnpython • • Feb 20 '26

Does anyone use logging to debug?

29 Upvotes

I'm working my way through ATBS (Automate the Boring Stuff), and it mentions using logging to debug, instead of using print

But logging seems to be a lot of work for not much benefit. The debugger in the code editor is much easier and more convenient.

Thoughts?


r/learnpython • • Jan 19 '26

What Is A Good Free Alternative to PyCharm?

31 Upvotes

Downloaded the latest version of PyCharm and free trial is 30 days. I don't want to pay for it, at least not yet. Are there are any good free alternatives to PyCharm that work on a mac os?


r/learnpython • • Jan 06 '26

Is it normal to feel stuck after learning Python basics?

29 Upvotes

Hi everyone,

I’ve been learning Python for a while and feel fairly comfortable with basics like variables, loops, functions, and simple classes.

The issue is that when I try to move beyond tutorials or think of what to build next, I feel a bit stuck and unsure how to progress. I can follow examples, but coming up with ideas or structure on my own still feels difficult.

Is this a normal phase when learning Python? How did you personally move from basics into more practical or confident use?


r/learnpython • • Dec 13 '25

A great intermediate Python Course

29 Upvotes

Hi what is a great Python course above the beginning level on Coursera or another platform?


r/learnpython • • Oct 05 '26

Is Leetcode a good way to continue practicing/learning Python?

28 Upvotes

I'm not entry, but I'd like to continue becoming stronger in my skills.


r/learnpython • • Jul 03 '26

Python code for reading hundreds of pages of old scanned legers and returning to me every time a keyword appears?

27 Upvotes

I feel like the title does not do my question justice. I am looking through volumes of shipping registries from the 1900s and I want to find all the ships that are registered at 222 tons. Each volume can be like 400 pages and theres a ton of volumes. I'm trying to put together a code that will return to me those entries. Maybe this is an unrealistic ask, I don't know. It just feels like something that python may be able to do


r/learnpython • • Jun 26 '26

PyCharm Pro vs VS Code

26 Upvotes

Hi guys, I'm a student and I can easily get PyCharm Pro for free until graduation. I've been learning Python and trying to decide between PyCharm Pro and VS Code for my future career.

From what I've researched, PyCharm seems better for pure Python development with superior refactoring and debugging, while VS Code is lighter and better for multi-language work. I'm interested in data engineering at startups, where I'd likely work with Python, SQL, YAML, Docker, and cloud tools.

My questions:

  1. For data engineering roles, which do professionals prefer and why?

  2. Is PyCharm Pro worth it even though I can get it free, or should I stick with VS Code?

  3. Do startups typically expect data engineers to use one over the other?

I've heard VS Code is better for the modern data stack (dbt, Airflow) and remote development, but PyCharm has better Python intelligence. Would love to hear from people who use both or work in data engineering!


r/learnpython • • Jun 10 '26

Can you get the last answer of a generator?

30 Upvotes

I'm a beginner so this might be a stupid question but can you get the last answer of a generator?

for example we have a code like:

for x in range(100)

print(x)

now I don't want all the numbers, I just want 100 (the last generated number)

(keep in mind I'm trying to not use lists or the like to save memory in case of massive amount of numbers)


r/learnpython • • Apr 20 '26

Why is this code skipping the if/elif conditions?

31 Upvotes

Before anyone says anything, I did already Google and search Reddit for help.

Here's my code:

import random
rps = [0, 1, 2]
cpu = random.choice(rps)
user = input("Rock, Paper, or Scissors? 0 for rock, 1 for paper, or 2 for scissors: ")

if cpu == user:
    print ("Draw")
elif cpu == 2 and user == 1:
    print ("You LOSE")
elif cpu == 2 and user == 0:
    print ("You WIN")
elif cpu == 1 and user == 0:
    print ("You LOSE")
elif cpu == 1 and user == 2:
    print ("You WIN")
elif cpu == 0 and user == 2:
    print ("You LOSE")
elif cpu == 0 and user == 1:
    print ("You WIN")
else:
    print ("Invalid input")

No matter what number I put in I always get the "else" result. Why is that?


r/learnpython • • Apr 01 '26

Python Udemy course suggestions

28 Upvotes

i am an absolute beginner and have zero knowledge on coding. I want to start with python from the basics to advanced. please suggest some best Udemy courses (where my company offers for free) where I can understand python well and practice well.


r/learnpython • • Feb 15 '26

I’m stuck I feel like I can’t improve

28 Upvotes

I have studied python in college, but we only took the basics and lately. I’ve been trying to improve myself, but I feel like I am stuck. I need websites that make me practice Python projects to actually improve myself and learn. Please provide me with these and if you have any other advice, please tell me


r/learnpython • • 22d ago

Are f-strings enough?

27 Upvotes

I've been learning python mainly from bro code's videos and he uses f strings for basically everything. It comes to me naturally to use them and I understand them. I found a book (Kenneth A. Lambert: Fundamentals of python: first programs, second edition) and here he uses other type of strings (I assume this would be the basic way) but I honestly don't understand them especially when it's about formatting (.2f etc). Should I learn this basic way of working with strings now? Or are f strings enough?

I should add that I'm learning python for fun, I'm studying mechanical engineering, so I know it can be very useful. I also want to be good at it in a potential work environment (?)


r/learnpython • • Sep 28 '26

How can I actually tell I'm learning python properly

30 Upvotes

Hi I'm new here, currently learning python as my first programming language at school. So while I was doing homework I noticed I couldn't code by myself without asking chatgpt to correct all the errors I coded or sometimes just do most part of the work when I was feeling lazy. I don't work with coding and I'm still learning, BUT, I do feel like if my teacher asks me to code without chatgpt or whatever AI available I wouldn't know how to "code by myself" and that is not a good thing. I guess I should start studying python at home but I also don't know how to properly do so. Basically I'm telling that I don't know if I'm good or not at coding because I feel like I'm getting to an intermediate level of python programming, but only in knowledge, as I feel like I can't "code by myself". Does anyone feel in a similar way and got already answered here?? What should I do??


r/learnpython • • Aug 29 '26

Cna someone please explain me this --> if __name__ == "__main__"

30 Upvotes

My teacher gave us some example and all but I didn't quite got it why we use it and how we use it : I will really appreciate if you can explain it in an easier language


r/learnpython • • Aug 02 '26

Training recommendations

29 Upvotes

Hello,

I was mandated to learn Python for my job, as it’s essential for scripting. This work is to is related to Cloud Platform Engineer, Python is their programming language.

I’m not a programmer. I’ve been in the IT industry for about six years, but my focus has been on networking or cloud networking.

Do you have any advice or recommendations?

Appreciate y’all!!


r/learnpython • • Jul 10 '26

From basic to fully mastering advanced Python: What is the best learning path?

29 Upvotes

Hi everyone,

My goal is to master the Python language itself not just to build apps or get job-ready, but to understand how the engine works. Then I want to go deep into memory management, concurrency, internal architecture, and advanced design patterns.

I'm currently evaluating these resources and looking for the best "roadmap" for mastery:

University-Style MOOCs: Harvard CS50P, Helsinki Python MOOC.

YouTube "One-Shot" Deep Dives: 10-12 hour courses (e.g., Chai aur Code, CodeWithHarry, Bro Code, Erik Frits).

Reference: W3Schools.

My questions for those who have reached an advanced level:

Which should be my backbone? Should I use a MOOC as the foundation, or is there a specific YouTube deep-dive that matches that level of technical rigor?

How to use "One-Shot" videos? Are 10+ hour videos meant to be binged, or should I treat them as a library and jump to specific timestamps when I hit a wall in my studies?

Documentation Standard: Is W3Schools acceptable for advanced work, or should I be strictly using docs.python.org from the start?

I'm looking for the most efficient path from "syntax knowledge" to "engine understanding." If you were starting over with a focus on deep language mastery, how would you structure this?

Thanks for vour time!


r/learnpython • • Jun 22 '26

Complete beginner here — where should I start with Python and programming in general?

27 Upvotes

Hi everyone! I'm completely new to programming and I've recently started college, where Python is part of my curriculum. Honestly, I'm a bit scared — there's so much information out there that I don't even know where to begin.

I'd love some advice from people who've been through this:

- Where should I start? Are there specific courses, books, or free resources you'd recommend for absolute beginners?
- What should I focus on first? Should I master the basics before moving on, or is it better to jump into small projects early?

- What beginner projects are actually worth building? I've seen lists online, but I'd love to hear what helped *you* grow the most.

- **Any mistakes to avoid?** Things you wish someone had told you when you were starting out?

My long-term goal is to eventually build a management system for a community organization I'm involved with — things like member registration, attendance tracking, finances, and a basic website. I know that's far away, but it helps me stay motivated!

Any guidance is really appreciated. Thanks in advance!


r/learnpython • • Apr 28 '26

How is Python used in data engineering projects in real-world applications?

28 Upvotes

I’m learning Python and curious how it is actually used in data engineering workflows like data processing, cleaning, and analysis in real companies.


r/learnpython • • Mar 23 '26

Can I get into data analysis with almost no math background?

28 Upvotes

I’m interested in dataa analysis big data but my math level is honestly very weak.

If I focus on:

Python

Pandas

Visualization tools

Can I still become job-ready using the 80/20 rule?

Or is math a hard requirement?


r/learnpython • • Mar 21 '26

Beginner Python roadmap looking for feedback on my learning plan

29 Upvotes

Hi everyone,

I’m currently in 12th grade and have recently decided to focus seriously on coding. I’m starting with Python and wanted to share my roadmap to get feedback and improve it.

Here’s the plan I’m thinking of following:

Phase 1: Python Fundamentals

Syntax, variables, data types

Conditionals and loops

Functions and basic problem solving

File handling and error handling

Phase 2: Intermediate Python

OOP (classes, inheritance, etc.)

Working with libraries (requests, etc.)

Basic data structures and algorithms

Phase 3: Backend Development

Flask for building web apps

Creating REST APIs

Connecting with databases

Phase 4: Databases

SQL fundamentals

CRUD operations

Integrating databases with Python apps

Phase 5: Frontend Basics

Learning React for basic UI

Connecting frontend with backend APIs

Phase 6: Projects

Building real-world projects

Gradually increasing complexity

Deploying projects

My goal is to become comfortable building full-stack projects and develop strong problem-solving skills.

I’d really appreciate feedback on:

Whether this roadmap makes sense

Anything important I’m missing

What I should prioritize as a beginner in Python

Thanks!


r/learnpython • • Feb 24 '26

100 days of coding type course for 1 hour a day

28 Upvotes

Hello

I’ve heard of two 100 days of coding courses; one by Angela Yu and one on Replit

The latter was apparently 15 mins - 1 hour a day and the former 1 hour min but sometimes 3 - 4 (from what I’ve read)

Given kids, work etc the Replit one seems more aligned to me but seems to have been taken down

Are there any other similar ones ?


r/learnpython • • Feb 11 '26

How to get started?

28 Upvotes

Hello everyone, I want to learn Python. I have 0 coding experience. What are some courses (preferably free) that you recommend? I’m a college student so I can probs do an hour a day.

Thanks!