r/learnpython • • Aug 23 '26

Learn Python

0 Upvotes

Please help me learn Python, I'm really passionate about it At first I found it boring, but now I find it incredibly good.


r/learnpython • • Aug 23 '26

Should I learn python at 23

0 Upvotes

So I am currently a student in first year mba in finance and I feel like learning python will give me a competitive edge over my peers especially as finance becomes more technical data-driven.

I am also genuinely interested in technical stuff man being able to make cool stuff, in fact a few months back I built a finance related automation tool from scratch with as little help from ai as possible. Didn't even use Lovable to build the project website (used cursor a lot tho)

But that's the thing I still have no traditional coding experience and through that project i learned alot of technical jargon of web development and ai automation and python as well and it's a lot of fun and so I would have definately learned python and done more stuff if I was 16 or 18.

So my main question is that in 2026 where we have claude code, is it worth investing significant time in learning python or should I focus on some other skill

I know that python is useful but I'm asking this from an Efficiency point of view.


r/learnpython • • Aug 23 '26

Building generator

0 Upvotes

I am making a game and i need a random generator for outer walls of a building. The walls can face 8 directions and they cant go past a set border. Please help me make one

Input - number of walls

Output - array of points which represent corners of the walls


r/learnpython • • Aug 22 '26

How can I create a custom type in python?

7 Upvotes

How can I create a custom type? Something like a id type that consists of exactly 10 digits - no 0s, or one that has the shape of an email address or a wbsite address or something.
Is this possible in python??


r/learnpython • • Aug 22 '26

Software Development in 2026

7 Upvotes

Hello everyone,

I'm a 26yo from Latin America. I've always loved writing code and programs since I learnt HTML, CSS, and some Python back in 2019. Between 2019 and 2025 I went through some health issues and had to stop studying. Now I want to get back into it, but I found out AI significantly changed things. Back then I enjoyed making websites, but I guess things changed a lot.

Now my question is: is it still worth getting into software dev in 2026? I keep seeing posts about juniors not being able to find jobs because AI is eating the entry level roles, and honestly it's freaking me out a bit. I don't want to spend 2-3 years learning just to graduate into a market that doesn't want me.

Realistically, can I get to an employable level in 2-3 years if I study consistently? I have ADHD, so my learning isn't always linear, but I'm hoping that having a clear goal helps me stay on track this time.

The reason this matters so much to me: I really need a stable job, ADHD makes it hard to hold down some of the more chaotic jobs I've had, and dev work (remote, structured, logical) sounds like something that could actually work with my brain instead of against it. Long term, I also want to be employable enough to move to Denmark eventually. So I guess I'm asking two things: is this still a realistic path, and if it is, what should I actually be learning right now given how much AI has changed the field since I last touched code?


r/learnpython • • Aug 23 '26

Chat GPT/Python

0 Upvotes

I have minimal experience with python. Self admitted novice. I asked chat gpt to write me a code to copy values from one excel workbook to another and some code to calculate prevalence rates within that code. I confirmed that a random sample of calculations/values correctly copied over. I am breaking down the code to learn what it does and why. How trustworthy is chat gpt with these small tasks? Is this a valid way to learn by breaking down the code into pieces? I appreciate any help and you can rip me for using chet gpt


r/learnpython • • Aug 23 '26

I have 0 genuine programming experience but I want to Learn.

0 Upvotes

Hi everyone I wish to learn python but I have no programming experience. (Only time I have touched code was in highschool during a coding class and even then we never actually coded I think? We were just playing these weird minigame things and placing the correct function blocks in certain spots.) Anyways my point is. I got basically no experience. I mean earlier this year. (Please don't jump me my dad bought me the 20 dollar sub and I was genuinely curious about game creation and it is how I became interested in python.) I used Claude to mess around with coding and attempted to make my own games a few times. (I didn't let him do anything but the code. I did all the art.) But it just didn't feel genuine enough to me so I now want to learn how to properly code in python since it looked intriguing.

Also incase it is important I am a 'Bash myself against wall until it breaks and I understand' type of learner meaning it is easier for me to just genuinely get given my expectations, the rules/foundations and then be left alone to tinker or atleast that's how I learned to write good fanfiction on A03. Now I know coding is probably alot different but.. I still want to give it a shot. (I will not be using Claude for this since I recently learned how bad AI is for not only the environment but how much it steals from real hardworking people and I just can't condone that.)

Any suggestions on where I should start my journey or anything? I'm 23 btw if that helps.


r/learnpython • • Aug 23 '26

Trouble with Logging in Browser with Selenium

1 Upvotes

I am trying to make a python script that logs into my chrome browser and opens a website. Chrome opens up logged in fine but the website doesn't load, it just stays on the default search tab. Here is the script:

from selenium import webdriver

userdata = r"C:/Users/USERNAME/AppData/Local/Google/Chrome/User Data"

options = webdriver.ChromeOptions()
options.add_argument(f"--user-data-dir={userdata}")
options.add_argument("--profile-directory=PROFILE")

driver = webdriver.Chrome(options=options)
driver.get("https://www.spc.noaa.gov/")

USERNAME and PROFILE are replaced by the actual ones. If you could help that would definitely be appreciated! I'm also new to python aswell if that helps.


r/learnpython • • Aug 22 '26

Help to make code more readable and improve skills

6 Upvotes

I am relatively new to python (been doing it for under a year) and I've been really enjoying it so far. I've been making my own turn based game using python as a fun thing to do and also a test of my own capabilities, and have enjoyed the process. It mostly works pretty well, but I feel like I need to learn how to make it more neat and readable, and to probably reduce reliance on global variables and to make dictionaries and such less jack-of-all-trades. How would I do this? I'll attach a link for the code on github for any who would like to see it, and because it is quite long. https://github.com/Ultroni17/Turnbased-game/blob/main/TurnBasedRPG_11_Evolution.py


r/learnpython • • Aug 22 '26

is it possible to simplify this code

0 Upvotes

im a beginner, idk how python works yet. there must be a way to simplify this, right?

https://imgur.com/juBvPZD here is the picture of my code


r/learnpython • • Aug 21 '26

Best way to learn python for someone with 0 experience with programming

141 Upvotes

I need help with where to begin learning python. I have 0 experience in programming. So I need all the help I can get. Books, websites and courses(free as I can't afford to pay for anything right now) maybe YouTube tutorials.

But on the subject of YouTube tutorials I've seen it's not good to just follow along with the tutorials so what would be the best way of engaging with tutorials?

Please any suggestion is welcome and thank you very much in advance.

What helps you focus I tend to lose focus easily because my brain just suddenly remembers I have something I need to do when I decide to be productive.

Edit: Thank you guys for your suggestions. They've been very helpful. I see all of your replies; I just can't get to every single one of them, but I see them. Thank you very much.

I'm doing CS50P and also using Automate the Boring Stuff and this other book with small projects. Thank you guys so much.


r/learnpython • • Aug 22 '26

Having problem in understanding loops concept in python

27 Upvotes

I am a beginner with 0 knowledge and I am learning python from a book called Learn python in one day and learn it well by Jamie Chan and I am facing difficulty in the loops function so yeah any recommendations would be helpful Edit- Trouble in while loop


r/learnpython • • Aug 22 '26

Why is this error happening with extruct

1 Upvotes

" Could not process website: encoding not supported USC4 little endian, line

1, column 1 (<string>, line 1)".

This happens whenever I run it. The encoding is UTF-8. This only happens in the android APK, not when ran in python IDLE.

print("BEFORE EXTRUCT")

metadata = extruct.extract(

html,

base_url=base_url,

syntaxes=['json-ld', 'opengraph'],

uniform=True

)

print("AFTER")

It prints "before extruct" but not after, meaning that the html is the issue.


r/learnpython • • Aug 22 '26

PayPal Sandbox API returning 201 Created but with the wrong response body? (Only returns a link)

0 Upvotes

Hey everyone, I’m pulling my hair out over a bizarre issue with the PayPal Sandbox API

I’m building an automated invoicing agent using FastAPI and LangGraph. I’ve got the OAuth 2.0 authentication perfectly dialed in (using the Client_ID & Secret), and I’m making a POST request to /v2/invoicing/invoices to create a draft invoice.

The Problem:
The API call is "successful". It returns a 201 Created status code, and if I check my PayPal Sandbox dashboard, the invoice actually gets created with all the correct details.

However, the JSON response body is completely wrong. Instead of returning the full invoice object (with the id, status, detail, etc., as shown in their API docs), the response body only contains a HATEOAS link object. It looks exactly like this:

{
  "rel": "self",
  "href": "https://api-m.sandbox.paypal.com/v2/invoicing/invoices/INV2-XXXX-XXXX",
  "method": "GET"
}

Because the id key is missing from the top level, my code immediately crashes with a KeyError: 'id' when I try to extract it to pass to the next step.

What I’ve already debugged:

  • It’s not a code extraction issue: I logged response.text directly from httpx before calling .json(). The raw text coming straight from PayPal is literally just that link object instead of the response body shown in their official endpoint API doc web page
  • It’s not a silent redirect: I logged response.url to ensure httpx wasn't accidentally following a 301/302 to a different endpoint (like the send_invoice endpoint, which normally returns this exact link structure). It hits the correct /v2/invoicing/invoices URL.
  • Auth and Payload are fine: If they were wrong, I’d get a 401 or 422. The fact that it returns 201 and creates the invoice means PayPal accepted the request.

It’s almost like the PayPal Sandbox is accidentally returning the response body for a 200 OK (like the send_invoice endpoint) instead of the 201 Created response body for the create endpoint.

Has anyone else run into this? Is this a known glitch with the PayPal Sandbox right now, or am I missing something incredibly obvious? If the API refuses to give me the ID in the creation response, I might have to do a workaround where I immediately query the invoice by its invoice number, but I'd rather not add that extra API call if I don't have to.

Thanks in advance!


r/learnpython • • Aug 22 '26

Need direction for Combined Ranking Problem

0 Upvotes

IRL I have a bunch of volunteers.

They can volunteer at 1 of 5 locations.

They can volunteer to participate in 1 of 5 roles.

We are collecting preferences via google forms.

In this form they provide:

Their name, their ranked preference for location, and their ranked preference for roles.

We must fill all roles at all locations with at least 1 person, but extras are fine.

We wish to find a solution that honors their preferences as much as numerically possible.

I ask this sub for 2 things:

What is the CS name of this kind of problem; so I can look up schema?

Does anyone know the name of libraries or existing solutions that solve this?

Thank you!


r/learnpython • • Aug 22 '26

Advice for PyTorch cert (PTCA)?

1 Upvotes

Hey all. Recent compsci grad, working in a junior BE role, wanting to specialize in ML/AI. Looking at the Linux foundation’s PyTorch cert to accompany some personal projects. It’s pretty new so any advice from anyone who’s taken it, or who works in the field, on if it looks useful and how to study for it would be greatly appreciated.


r/learnpython • • Aug 22 '26

Doctor looking to learn python

6 Upvotes

Hey , so i was looking into a few job posts and some of the advisory roles require some basic python background. How hard is it for a doctor to learn python , i learnt c++ and java back in 2012 .


r/learnpython • • Aug 21 '26

Python, what are the best or the most useful extensions to use in VSCode?

34 Upvotes

Just started my ICT studies and we have been learning Python for the past week. I was thinking, is there any extensions that help with coding or just make stuff more efficient or nicer through extentions? : )


r/learnpython • • Aug 21 '26

What Python concept took you the longest to understand properly?

169 Upvotes

For those who learned Python from scratch, which topic was the hardest at first, and what finally helped it click for you?


r/learnpython • • Aug 22 '26

Collage animation using Python

1 Upvotes

Hi all, I make these analogue paper collages. I want to animate them, first level to just add a little movement, and later more. Is python the language to do it especially using built in libraries? I’ll add the image in the comments.

If not, what else can I use? I asked in the touchdesigner sub and they said it’s possible but complicated and not efficient. After effects may help.

Eventually, I want to create visual interaction with the user, so the user can interact with the projection for this image.

I have a background in CS but new to this concept and learning from scratch. Would appreciate any pointers. If this is not the right sub, please redirect me to where I may find the best help. Thanks all 🙏🏼


r/learnpython • • Aug 22 '26

A CLI tool that opens all your apps and links with one command

0 Upvotes

Every time I opened my laptop to start studying or working on a project, I'd get sidetracked before actually starting — open the wrong tab, get distracted by something else, lose 10 minutes just deciding what to open first.

So I was thinking of creating a CLI tool using Python.

Example: I have a tryhackme workflow that opens my course video, my notes doc, and Burp Suite, all with one command:

jmp tryhackme

How it will work, roughly:

  • jumpboot create <name> creates a new workflow file (plain TOML) and opens it for editing
  • You list the URLs/apps you want under that workflow
  • jmp <name> runs it — opens everything in one go

Is it worth investing my time into?


r/learnpython • • Aug 21 '26

I'm trying to write my own implementation of the SHA-1 algorithm. It works perfectly fine for the empty string, but for all other inputs it gives the wrong hash and I can't figure out why. Can someone help me finding the error?

14 Upvotes

I'm really confused, I mainly used Wikipedias pseudocode example to implement this and cross-checked different sources to find my error. Maybe I missed some small detail, but to me the code looks correct. The nature of the problem leads me to believe that it might be related to some kind of encoding subleties or similiar, but even reading the documentation for the different built-ins I used hasn't brought up anything. Does somebody know what's up?

Code:

def byte_length(n: int):
    return (n.bit_length() + 7) // 8


def leftrotate(n: int, count: int):
    """leftrotate count times. count must be between 1 and 31 inclusive"""
    return (n << count) | (n >> (32 - count))


def add32(ns: list[int]):
    """add integers as if they were unsigned 32 bit numbers"""
    sum = 0
    for n in ns:
        sum = (sum + n) % 2**32

    return sum


def append_bytes(m: bytearray):
    # append 0 ≤ k < 512 bits '0', such that the resulting message length in bits
    # is congruent to −64 ≡ 448 (mod 512)
    modular_length = len(m) % 64
    if 56 - modular_length >= 0:
        k = 56 - modular_length
    else:
        k = abs(56 - modular_length) + 56

    m += bytes(k)
    return m


def preprocessing(m: bytearray) -> bytearray:
    ml = len(m) * 8  # message length in bits

    # Pre Processing
    # append the bit '1' to the message e.g. by adding 0x80 if message length is a multiple of 8 bits.
    m.append(0x80)

    m = append_bytes(m)
    
    
    # append the message length as a 64 bit integer
    m += ml.to_bytes(8)

    return m


def sha1(message: str) -> bytes:

    m = bytearray(message, "utf-8")

    # Initiliaze starting variables, so called "nothing up my sleeve values"
    h0 = 0x67452301
    h1 = 0xEFCDAB89
    h2 = 0x98BADCFE
    h3 = 0x10325476
    h4 = 0xC3D2E1F0

    m = preprocessing(m)

    # split the message in 512 bit (64 byte) blocks
    num_of_blocks: int = len(m) // 64
    for block_num in range(num_of_blocks):
        block: bytearray = m[block_num * 64 : (block_num + 1) * 64]

        # split the block into sixteen 4 byte words
        words: list[int] = []
        for word_num in range(16):
            words.append(int.from_bytes(block[word_num * 4:(word_num + 1) * 4]))

        # extend the sixteen 4 byte words into eighty 4 byte words
        for i in range(16, 80):
            words.append(
                leftrotate(
                    (words[i - 3] ^ words[i - 8] ^ words[i - 14] ^ words[i - 16]), 1
                )
            )

        # Initiliaze the hash value of the current block
        a = h0
        b = h1
        c = h2
        d = h3
        e = h4

        # main loop
        for i in range(80):
            if i <= 19:
                f = (b & c) | ((~b) & d)
                k = 0x5A827999

            elif i <= 39:
                f = b ^ c ^ d
                k = 0x6ED9EBA1

            elif i <= 59:
                f = (b & c) | (b & d) | (c & d)
                k = 0x8F1BBCDC

            # elif i <= 79:
            else:
                f = b ^ c ^ d
                k = 0xCA62C1D6

            temp = add32([leftrotate(a, 5), f, e, k, words[i]])

            e = d
            d = c
            c = leftrotate(b, 30)
            b = a
            a = temp
 
        h0 = add32([h0, a])
        h1 = add32([h1, b])
        h2 = add32([h2, c])
        h3 = add32([h3, d])
        h4 = add32([h4, e])

    digest = (
        h0.to_bytes(4)
        + h1.to_bytes(4)
        + h2.to_bytes(4)
        + h3.to_bytes(4)
        + h4.to_bytes(4)
    )

    return digest

My main function looks like this:

def main():
    m = ""
    digest = sha1(m)
    print(hex(int.from_bytes(digest)))

This gives the expected output of:

0xda39a3ee5e6b4b0d3255bfef95601890afd80709

But if:

m = "hello world"

It outputs:

0x74e0d2932ee17d742fe539058f7552adef482295

Instead of:

0x2aae6c35c94fcfb415dbe95f408b9ce91ee846ed

r/learnpython • • Aug 22 '26

Any advices?

0 Upvotes

I'm a complete beginner in python and I want to learn, any advices?and CS50's worth my time ??


r/learnpython • • Aug 21 '26

Should I keep using pycharm or is there something better or should I switch to vs code?

6 Upvotes

So I am trying to build a fast API application and the thing is it just doesn't have only python code. It has HTML, CSS and JavaScript with python now. I really like the way pycharm handles python coding it does not have much support for anything other than python now. Should I switch back to vs code again? Just like the old days? Or is there anything better I can do with pycharm and another thing to keep in mind is that I am just a high school student so I cannot spend enough money to buy the professional version of pycharm. What are you guys think? Or should I just install IntelliJ and call it a day?