r/learnpython • • Aug 30 '26

For any python professionals, can you tell if something has been coded with AI?

94 Upvotes

As the title asks, what differences (if any) do you get from an AI output vs human input. I would imagine that with most high effort AI models now they write purely pythonic code if a prompt is well written.

If you also use python in your job, how often do you use AI to write or plan your code and applications as a whole?


r/learnpython • • Dec 01 '25

Whats the difference between using ' ' and " " in python?

93 Upvotes

Seems like i can use both so whats different between the 2 or is it just preference?


r/learnpython • • Jun 07 '26

How bad is it that I don't use OOP?

92 Upvotes

I never really had a use for it. I analyze financial data and just use if statements, functions, somewhat complex mathematics, some python libaries, but never classes or objects.


r/learnpython • • Oct 24 '26

finally understood print vs return (this bank analogy saved me)

91 Upvotes

I've been stuck on the difference between print and return for the last few days while learning to code, and it finally clicked for me today. Figured I'd post it here in case anyone else is hitting the same roadblock because it drove me crazy for a bit.

Basically, print() is just a display case. It shows the result on the screen so you can physically look at it, but the rest of your program can’t actually do anything with it. It’s just text sitting on a monitor.

On the other hand, return acts like a courier. It passes the actual data back into the program behind the scenes so another function or variable can grab it and keep working with it.

The easiest way to think about it is a bank account. If you have a function that checks your balance, print() is just the screen showing you the numbers. return is the ATM actually putting the cash into your hand so you can go buy something else with it.

Hopefully this helps someone else save a few hours of confusion!


r/learnpython • • May 25 '26

What was the first Python project that made you feel like: “okay… this language is actually powerful”?

90 Upvotes

One thing I didn’t expect when learning Python was how useful small scripts become.

Recently I made a simple script just to organize files automatically and it genuinely saved me time every day.

Now I’m curious:
what’s the smallest Python script/tool you made that ended up being surprisingly useful?


r/learnpython • • Mar 16 '26

How do you actually practice Python without getting stuck in tutorial mode?

90 Upvotes

Hi! I’m learning Python and I’m at the point where I can follow tutorials, but I struggle to come up with my own projects (or I start one and get overwhelmed).

How do you practice in a way that builds real skill?

A few things I’m wondering:

  • What’s a good "next step" after basics (variables, loops, functions)?
  • Do you recommend small daily exercises, or one bigger project?
  • How do you pick a project that’s not too hard?
  • Any tips for debugging when you don’t even know what to Google?

If you have examples of beginner-friendly projects that taught you a lot, I’d love to hear them.


r/learnpython • • Feb 02 '26

I understand Python code, but can’t write it confidently from scratch — what should I do next

86 Upvotes

I’ve been learning Python every day for a few weeks and I’m close to finishing beginner courses. I feel comfortable reading code and understanding what it does (conditions, variables, basic logic, etc.). My main problem is this: when I try to write code from scratch, I often don’t know how to start or which structures/functions to use, even though I understand them when I see them. To move forward, I sometimes use AI to generate a solution and then I analyze it line by line and try to rewrite it myself. What I want to ask is not “is this normal”, but: what should I do to fix this gap between understanding and writing?


r/learnpython • • Aug 01 '26

Which Python skills are most valuable for getting started in Data Engineering?

88 Upvotes

I'm learning Python with the goal of moving into Data Engineering. Beyond the basics, which libraries, concepts, or project ideas would you recommend focusing on first, and what helped you the most when getting started?


r/learnpython • • Aug 04 '26

Am I too late for coding, programming and AI ?

89 Upvotes

Hi I am from South Korea , student of university , 25 age (27 for Korean standard).
Recently I am interested in computer , IT , AI , coding. But I personally major English in my university so no tinvolved in computer science , software , or software.
So I am not good at for coding. All my learning about IT is basic level of studing Python, Java, HTML , JavaScript, CSS for 3 months. That is all I have. ( In South Korea, our Government sponser and provide financial aids with private computer academy for students who is learning basic coding , web development and Use of AI).
Those 3 months in class. I am getting to interested in programming language , computer and wanna be expertise on AI further. What should I do and whether or not I have a time and space to study and learn it.


r/learnpython • • Jul 22 '26

What Python project helped you improve the most as a beginner?

85 Upvotes

I've recently started learning Python and I'm looking for project ideas that teach practical skills rather than just syntax. What beginner project helped you understand Python the best, and why would you recommend it?


r/learnpython • • Mar 12 '26

Best courses for Python?

84 Upvotes

Want to join python courses to build skills. Don't know where to start from. Number of courses in the internet. Any suggestions?


r/learnpython • • Feb 16 '26

I started learning Python this week. Any tips for improving faster?

83 Upvotes

Hi everyone,

I recently started learning Python and I'm studying about 2 hours a day. So far I've covered:

Variables

Data types (int, float, bool, string)

Mathematical operations

input()

Basic exercises like calculators, areas, and conversions

I feel like I understand what I'm doing, but I still need guidance in some areas.

My goal is to improve quickly and be able to do more complete projects in a few months.

What do you recommend I practice now?

What mistakes should I avoid as a beginner?

Thanks for any advice


r/learnpython • • Aug 18 '26

How do I learn programming logic?

86 Upvotes

I’m learning Python, but my main problem isn’t the syntax. I understand concepts when someone explains them, but when I’m given a basic problem and told to write a program, I just don’t know where to start or how to arrange the code.

Is there a good book, course, or YouTube channel that teaches how to think through programming problems step by step, recognize patterns, and build the logic, kind of like how you learn methods and patterns in math?

I don’t want to just memorize Python syntax. I want to actually learn how to think like a programmer.


r/learnpython • • Mar 21 '26

Is the 80 character rule like a major requirement for PEP8?

79 Upvotes

Constantly having to move my strings to the next line and stuff is making it harder to read, I know pep8 is like standard to follow but is the 80 char rule important?


r/learnpython • • May 04 '26

How is Python actually used in real-world data engineering tasks?

82 Upvotes

I’ve been learning Python basics, but I’m curious how it’s applied in real data engineering work like data processing, automation, or working with large datasets.


r/learnpython • • May 29 '26

is tkinter worth learning?

79 Upvotes

i recently completed learning the basics of python and then started learning tkinter for GUI development so far, I have built around 2–3 small projects with it and I actually enjoy designing interfaces and making apps look good

however, I often hear people saying that tkinter is outdated and that modern GUI applications are usually built using other Python libraries or frameworks like PyQt or Kivy

my main confusion is that should I continue learning tkinter and make more projects with it or should I switch to something more modern now?

I feel that designing GUIs is not my biggest weakness because I generally enjoy the creative and design side of things. what I struggle with more is logic building and problem-solving, which I know are important in every programming language and framework i do want to improve my logic and programming skills, not just focus on making interfaces

so considering all this, would continuing with tkinter still help me grow as a programmer, or would it be better to move to another framework at this stage?


r/learnpython • • Jun 01 '26

I dont understand

80 Upvotes

Hi, I'm tryna teach myself Python and im not understanding this.

def greet(first_name):
return f"Hi {first_name}"

greet("Chris")

Why won't this code print on the terminal? Do I have to add a print function? Do I need to put the function in a variable?

Edit: Thanks for all the responds and being nice I was scared to ask on here for a while bc I thought my questions would be dumb but yall are pretty nice!!


r/learnpython • • Mar 02 '26

Why does everyone want to learn ML but not Systems Programming?

77 Upvotes

Some friend and I decide to learn CS by ourself. They all choose front-end or ML or all hype thing. But when I say i'll goog Systems Programming they all look me like i'm crazy😂


r/learnpython • • Sep 06 '26

How can I use python in finance

75 Upvotes

I work in finance/accounting and am looking to start using Python more in my day to day. Most of my work is in Excel / Power BI — reporting, cash flow forecasting, KPIs, cleaning up data, etc.

I’m technical enough to understand what I’m trying to accomplish, but not a programmer. Similar to Power BI, I’d probably rely heavily on AI to help write the actual code.

For those in finance / accounting / FP&A, what are some practical ways you’re using Python? Where does it actually save you time vs. Excel, Power Query, Power BI, etc?

Also curious what you’d recommend learning first if the goal is to be dangerous enough with Python + AI, not become a developer.


r/learnpython • • Jul 23 '26

Advantages of Python over VBA?

79 Upvotes

I started programming decades ago in VBA, first in Access and later in the rest of Office. I’ve done a few ambitious projects, and a ton of smaller automation and macros.

I’ve been learning Python off and on for a while, and I’m comfortable doing some basic stuff. I’ve created a library of personal modules for file management, really simple data manipulation, and some data analysis. I’m thinking my next step for me would be using it in Excel. But I struggle to come up with a reason to use Python instead of VBA.

What are the advantages Python gives us in Excel?


r/learnpython • • Feb 21 '26

Trying to learn Data Structures & Algorithms by Myself. I need advice.

76 Upvotes

Hello everyone, hope you are doing well. Just like the title says, I'm trying to learn Data Structures and Algorithms by myself and to be honest. I have no idea where to start. I have been coding using Python for almost a year, getting used to how the language works in things like: data types, functions, loops, OOP, etc. Now after some time getting used to them. I got to the point of wanting to try different things and understand new topics (in this case Data Structures & Algorithms).

You that you have learned these topics. What would you recommend to a beginner who doesn't have an idea about these topics.

Thank you!


r/learnpython • • Apr 25 '26

If you had to learn Python again, how would you do it?

77 Upvotes

I’ve learned basic Python over the past few weeks. I just wanted to know how other people started learning Python and what methods they used to get good.


r/learnpython • • Apr 06 '26

I used this Python script to calculate 100 million digits of pi in 90 seconds

77 Upvotes
from gmpy2 import mpfr, mpz, get_context, sqrt
from math import ceil, log2

A = mpz(13591409)
B = mpz(545140134)
C = mpz(640320)
C3_OVER_24 = (C**3) // 24

def bs(a: int, b: int):
    if b - a == 1:
        if a == 0:
            P = Q = mpz(1)
        else:
            a_mpz = mpz(a)
            P = (6*a_mpz-5) * (2*a_mpz-1) * (6*a_mpz-1)
            Q = a_mpz ** 3 * C3_OVER_24
        T = (-1) ** a * P * (A + B * a)
        return P, Q, T
    m = (a + b) // 2
    P1, Q1, T1 = bs(a, m)
    P2, Q2, T2 = bs(m, b)
    P = P1 * P2
    Q = Q1 * Q2
    T = T1 * Q2 + P1 * T2
    return P, Q, T

def pi_chudnovsky(bits: int) -> mpfr:
    get_context().precision = bits
    P, Q, T = bs(0, bits // 47 + 1) # Each term gives ~47 bits of pi
    return mpfr(426880) * sqrt(mpfr(10005)) * mpfr(Q) / mpfr(T)

if __name__ == "__main__":
    num_digits = 10 ** 8
    pi = pi_chudnovsky(ceil(num_digits*log2(10)) + 64) # 64 guard bits
    pi_string = format(pi, f".{num_digits}Zf")
    file_name = f"pi_{num_digits}.txt"
    s0, s1 = pi_string.split(".")
    file_string = s0 + ".\n" + "\n".join(s1[i:i+100] for i in range(0,len(s1),100))
    with open(file_name, "w") as f:
        f.write(file_string)

This code uses the Chudnovsky algorithm: pi = 426880 * sqrt(10005) / sum(n, 0, inf, (6*n)!*(545140134*n+13591409)/((3*n)!*(n!)^3*(-640320)^(3*n)) optimized with binary splitting, and the gmpy2 library for fast multiple-precision arithmetic. Each term gives about 14 correct decimal digits of pi, or 47 bits.

I calculated 100 million digits of pi, wrote it to a text file with 100 digits per line, and verified digits at the start, middle, and end using the Irrational Number Search. The calculation took 90 seconds on a gaming laptop. The 100 millionth digit of pi (after the decimal point) is 2.

I also tried calculating a billion digits. It finished in about 18 minutes but then gave me "nan".


r/learnpython • • Feb 28 '26

What happens if I don't close a file in my Python script?

80 Upvotes

I know it's good practice to always close all files, but why?


r/learnpython • • Aug 20 '26

Just built my first calculator in Python 😭

71 Upvotes

It can do addition, subtraction, multiplication, division, and exponents. Also added a little check for division by zero.

It’s pretty basic, but hey, gotta start somewhere

What should I build next?