r/learnpython

What do you guys use Python to do?

A friend told me he's learning to build small apps for himself to help him with minor things. For example, he's working to build a habit tracker app and a reminder/to-do list app. He's learning JavaScript.

On a related note, a lot of people say the best way to learn any coding language is to use it to do something for you or make something easier for you. Basically, build stuff with the language in order to better learn it.

I started learning Python three days ago. There's a YouTube tutorial 12 hours long by this guy named Bro Code that I'm using to start learning. I want to start doing stuff with Python as well, but I'm not sure at what point I'll be ready to try building something, or even what to build for a project. So far, the only things I know are print statements, variable types, and typecasting. I'm learning this on the side since my job takes up most of my week.

So what do you guys use Python for? What have you made with it? How have you used it to make something easier for yourself or do a task faster?

reddit.com
u/BobMarleyLegacy — 15 hours ago

Looking for study partner (Data Science/analyst)

Hey everyone,

I’m Aaron (25) and I’m looking for a study partner interested in data analysis / data science.

Currently working on MySQL, and I also have some experience with Pandas, NumPy, and Plotly. I’ve been away from coding for a while, so I’m a bit rusty at the moment, but I’m getting back into it and want to stay consistent. I’m also planning to improve my skills in visualization (Matplotlib/Seaborn) and build projects.

I’m looking for someone around my age who is genuinely serious about studying regularly (daily or almost daily IST). I’m an introvert, so I might take a little time to get comfortable just looking for someone patient and consistent.

No ghosting please let’s keep it mutual and respectful.

I’m open to sharing my screen during study sessions and keeping each other accountable.

feel free to DM 🙂

reddit.com
u/OneFaintFlicker — 7 hours ago
Markov chain poetry generator

Markov chain poetry generator

Hi, I'm new here. I have been Python coding for 6 weeks pretty seriously on a daily basis. I made a script today for using a Markov chain to generate a poem line by line, including a corpus text of about 2,600 sentences that I have on my GitHub.

I don't really have anybody to share my scripts with when I'm done, so... What do you think of it? It's the first thing I've written that has some level of real value. I know the first half of the script could be less clunky, but it's the one part I wasn't totally sure how to accomplish in an elegant way. Any tips? And I somehow never knew about match case statements before this project...

None of it was written by AI. The script is here for your viewing pleasure. You can find the poetry lines CSV for the corpus at my GitHub: https://github.com/QuothTheRaven42/Projects

import random, sys
from termcolor import colored

print(colored("---------------MARKOV CHAIN POETRY GENERATOR---------------", "blue", "on_grey", attrs=["bold"], force_color=True))

def main(poem=""):
    count = 0
    quadruplets = []
    piece = []
    piece2 = []
    piece3 = []
    piece4 = []

    with open("poetry_lines.csv", encoding="utf-8") as f:
        poetry_lines = f.readlines()

    for line in poetry_lines:
        # reset so the quads don't bleed over into other sentences awkwardly
        piece = []
        piece2 = []
        piece3 = []
        piece4 = []
        count += 1

        # staggering the start of quads
        for word in line.split():
            finalized_word = (word.lower()
                            .replace(".", "")
                            .replace("—", ""))

            if count == 1:
                piece.append(finalized_word)
            elif count == 2:
                piece.append(finalized_word)
                piece2.append(finalized_word)
            elif count == 3:
                piece.append(finalized_word)
                piece2.append(finalized_word)
                piece3.append(finalized_word)
            else:
                piece.append(finalized_word)
                piece2.append(finalized_word)
                piece3.append(finalized_word)
                piece4.append(finalized_word)

            # append once a quad list has the required 4
            if len(piece) == 4:
                quadruplets.append(piece)
                piece = []
            elif len(piece2) == 4:
                quadruplets.append(piece2)
                piece2 = []
            elif len(piece3) == 4:
                quadruplets.append(piece3)
                piece3 = []
            elif len(piece4) == 4:
                quadruplets.append(piece4)
                piece4 = []

    # always ask for the first word of each line
    word = input("What should the first word of this line be? ").lower()
    print()

    # reset input if no quad starts with their word
    while not any(quad[0] == word for quad in quadruplets):
        word = input("Word not found in corpus. Try again: ").lower()

    this_line = ""

    for _ in range(5):
        try:
            # append next quad to the sentence
            quads = [quad for quad in quadruplets if quad[0].lower() == word.lower()]
            chosen_quad = random.choice(quads)
            if _ == 0:
                this_line += " ".join(chosen_quad)
            else:
                # don't add first word if it's not the first quad so the word doesn't repeat
                this_line += " ".join(chosen_quad[1:])
            word = chosen_quad[3]
            this_line += " "
        except IndexError:
            break

    finalized_line = this_line.capitalize().strip()
    print(finalized_line + "\n")

    finalized_poem = (poem.strip()
                      .replace(" i ", " I ")
                      .replace("i'", "I'")
                      .replace("  ", " ")
                      .replace(",", "")
                      + ".")

    choice = input("""Do you want to:
    (1) Append to your poem?
    (2) Retry this line?
    (3) Print final poem and quit?
    (4) Save to file and quit?
    (5) Quit? """).strip()

    enjoy = "***********ENJOY YOUR NEW POEM!***********"

    match choice:
        case "1":
            poem += "\n" + finalized_line
            print(poem + '\n')
            main(poem)
        case "2":
            print(poem + "\n")
            main(poem)
        case "3":
            poem += "\n" + finalized_line
            print("\n" + finalized_poem + "\n")
            print(enjoy)
        case "4":
            title = input("\nWhat do you want to name this poem? ")
            filename = title + '.txt'
            with open(filename, 'w') as file:
                poem += "\n" + finalized_line
                print(f'\n"{title.capitalize()}"')
                print("\n" + finalized_poem)
                file.write(finalized_poem)
                print(f"\nfile saved as {filename}\n")
                print(enjoy)
                sys.exit()
        case _:
            poem += "\n" + finalized_line
            print("\n" + finalized_poem + "\n")
            print(enjoy)
            sys.exit()

if __name__ == '__main__':     main()
u/Affectionate-Town-67 — 8 hours ago

Do you read every sentance in a course or book?

So I have been reading trough freecodecamp and due to my adhd it´s painfully boring, especially alone. I feel like I miss important stuff by snoozing over text, but I get anxiety if I read through a text multiple times, so how do you people do, is it fine to miss some info and ask a diffirent person later?

reddit.com
u/MetalCarnival — 4 hours ago

Change of career

Hello. I’m 38 and soon to be made redundant. I have a lot of free time until I get made redundant December 2027. I’d like a new career change and seeing that we’re in a computer orientated world now would like to learn Python to increase my career goals. Is python hard to learn for a complete beginner? I have about 4 days off per week in which I can learn a new skill.

reddit.com
u/Independent_Ask5869 — 23 hours ago

help w/ if statement

Making a simple love calculator. When I input Y or N, it automatically skips the if and elif and returns the else statement. What is wrong with my code?

def love_calc ():
    print("Welcome to the Love Calculator! ♡ ")
name1 = str(input("What is your name?: \n"))
name2 = str(input("What is their name?: \n"))
combined_string = name1 + name2
lower_case_string = combined_string.lower()
true_count, love_count = 0, 0
for name in combined_string:
    for letter in ["t","r","u","e"]:
        true_count += name.count(letter)
for name in combined_string:
    for letter in ["l","o", "v", "e",]:
        true_count += name.count(letter)
total_count = int(str(true_count) + str(love_count))
if total_count < 10 or total_count > 90:
    print(f"Your score is {total_count}, you are like peanut butter and jelly!")
elif total_count >= 40 and total_count <= 50:
    print(f"Your score is {total_count}, you go together just fine.")
else:
    print(f"Your score is {total_count}.")
question = input("Would you like to restart? (Y/N): ")
if question == ("Y", "y"):
     love_calc
elif question == ( "N", "n",): 
    print ("Thank you for playing!")
else:
    print("Not a valid response!")
reddit.com
u/k4tsuk1z — 23 hours ago

How much SQL do I really need to learn for junior Python backend roles?

Ive been learning Python for about 8 months. Im comfortable with Flask, basic OOP, and making API calls. But I keep seeing job postings that ask for SQL experience. I know the absolute basics like SELECT, INSERT, and simple JOINs. I can use sqlite3 in Python to run queries. But Ive never worked with PostgreSQL in production or designed complex database schemas from scratch. Should I pause my Python learning and spend a few weeks really drilling SQL? Or can I learn it on the job as long as I understand the fundamentals? I dont want to waste time if most places just use ORMs anyway. What level of SQL is actually expected from a junior?

reddit.com
u/frankgetsu — 24 hours ago
▲ 1 r/learnmachinelearning+1 crossposts

How can I learn PYTHON libraries with good practice???

Can someone tell me how or where should I start learning the libraries of Python NUMPY, PANDAS, MATPLOTLIB, SCIKITLEARN, etc.

If someone have idea of these and good courses or books please suggest me

And a good path to learn it.

reddit.com
u/Embarrassed_Ship_269 — 9 hours ago

Reference data

I'm wondering what is the nearest way to store reference data variables (constants) in a project.

I think loading them from file or environment variables is a bit of an overhead with the file open etc.

I'm thinking of putting them in a separate .py file then importing them.

Even then I'm not sure whether to import (when required) at the top of each code file, or within each function that uses one.

Note I am just a hobby coder and not a pro within a large team.

What is the cleanest approach?

reddit.com
u/worldtest2k — 18 hours ago

FastAPI not working remotely

EDIT: It was interference from RAS. Removing RAS solved the problem, but I still need to figure out a way to use both.

I am trying to create a fastapi/uvicorn server, but I can't access it remotely. I have already set the host to '0.0.0.0' and I've already allowed it through my firewall. It works absolutely fine when accessed from localhost, but all external requests, from lan and wan, time out. I am using Windows Server 2025.

run(
    app = 'API.app:app',
    host = '0.0.0.0',
    port = 8000,
    workers = (None if VERBOSE else 2),
    ssl_certfile = this.file('certificates/cert').path,
    ssl_keyfile = this.file('certificates/key').path,
    log_level = "critical"
)
class CustomMiddleware(BaseHTTPMiddleware):

    def _log(self,
        request: Request, 
        status: str
    ) -> None:
        
        params = parse_qs(request.url.query)

        for name in params:
            if 'password' in name:
                params[name] = '***'

        Log.INFO(f"""
 HOST  = {request.client.host}
 PATH  = {request.url.path}
PARAMS = {params}
METHOD = {request.method}
STATUS = {status}
""")
    
    async def dispatch(self, 
        request: Request, 
        call_next
    ):

        self._log(request, '...')

        # Process the request
        response = await call_next(request)

        # Add the allow-all-origins header directly to the response
        response.headers["Access-Control-Allow-Origin"] = "*"
        response.headers["Access-Control-Allow-Methods"] = "*"
        response.headers["Access-Control-Allow-Headers"] = "*"

        self._log(request, response.status_code)

        return response
    
    async def __call__(self, *args, **kwargs):
        try:
            await super().__call__(*args, **kwargs)
        except Exception as e:
            Log.FAIL(str(e))

app.add_middleware(CustomMiddleware)

EDIT: I just tried disabling firewall altogether and it still didn't work. It shouldn't be any port forwarding issue, though. The server is a DMZ host, and lan doesn't work. I even changed the port for all clients and server to 8100 and it still didn't work.

My browsers gave this info:

Localhost:

"timings": {
          "blocked": 0,
          "dns": 0,
          "connect": 0,
          "ssl": 5,
          "send": 0,
          "wait": 1211,
          "receive": 20
}

LAN Client:

"timings": {
          "blocked": 0,
          "dns": 1,
          "connect": 0,
          "ssl": 0,
          "send": 0,
          "wait": 0,
          "receive": 
}
reddit.com
u/philtrondaboss — 18 hours ago

App for learning Python

I ve made a small app for learning Python on Android , I would be happy if someone of you can use it and share the honest opinion if app is helpful for you. ✨

BrainAcademy: Learn Python on play store

reddit.com
u/Inevitable_Map_810 — 11 hours ago

Sava location for Python Installer Manager

I saw Python Installer Manager in the official website but it seems only can be installed to user directory. I plan to install globally for all user. Is there any way to do that?

reddit.com
u/Ayano-Keiko — 5 hours ago

Built a voice AI assistant in Python as a beginner — here’s what nearly broke me

been learning Python for a while and decided to build something real instead of just following tutorials.

ended up building a voice controlled AI assistant.

here’s the stack and the problems i actually hit:

Stack:

∙	Vosk — offline speech recognition

∙	Google Gemini Live API — response generation

∙	edge-tts — voice output

What nearly broke me:

the STT → LLM → TTS pipeline latency. every layer works fine alone but chaining them together without lag is a completely different problem. spent weeks just on this. ended up building a custom audio queue to stop responses overlapping.

wake word accuracy was second biggest issue. Vosk misfires around 8-10% in noisy environments. considering Whisper but worried about the latency tradeoff.

Questions for this community:

∙	Vosk or Whisper for a latency-sensitive pipeline?

∙	better approach to audio queue management?

∙	any lightweight persistent memory solution worth trying?

still learning honestly — would love input from people who’ve tackled similar problems 👇

reddit.com
u/Ronak-Aheer — 1 hour ago

How do I format outputs from packages?

I am messing around with the python_weather package and I've got my program working the way I want it to but the output for weather.kind prints the words capitalized. I want the output to generate as 'partly cloudy' instead of 'Partly Cloudy' but nothing I do seems to change the output.

reddit.com
u/Booty4Breakfasts — 2 hours ago

I built a free Python mock test with anti-cheat certificate from Kashmir, India 🇮🇳

Hey r/learnpython! 👋

I'm Faizan, a Software Engineering student from Kashmir, India.

I built FaizuPyzone — a free Python mock test platform because students

in Kashmir deserve world-class tools too.

What makes it different from other Python tests:

🔒 Anti-cheat proctored exam

- Fullscreen lock

- Tab switch detection (3 switches = fail)

- Copy-paste blocked

- Personal watermark with your name

🏆 Real certificate

- QR verified with unique ID

- PDF + 4K PNG download

- LinkedIn ready

📝 3 levels

- Basic (FREE) — 60 questions, 60 minutes

- Advanced (₹99) — OOP, file handling

- Pro (₹199) — Decorators, generators, concurrency

✅ Pass mark is 55%

✅ Instant results

✅ No account needed for Basic

Would love feedback from this community!

👉 faizupyzone.shop

Thanks! 🙏

reddit.com
u/SherbetOk3199 — 7 hours ago

Que Bagunça Meus Estudos

pessoa eu estou estudando Python porem estudo de varias fontes diferentes, videos, livros ,sites.

queria saber se isso atrapalha, se tenho q escolher uma unica fonte e focar nela e nao me perder em varias ao mesmo tempo.

e se vc conhecem um bom curso de Python tipo na udemy ou outra plataformas q seja em conta.

e tbm aceito dicas de estudo pra nao se perder em tutoriais infinito.

reddit.com
u/AndreySousa — 8 hours ago

python for cybersecurity

Hey currently I'm learning python I learned till like OOP and was able to make simple programs and things like that and the main reason I'm learning python is for ethical hacking and I started the black hat python book which is really great im in the python networking chapter. so what I wanted to ask is that is this like the correct way or order or should I learn other things in python before jumping to the black hat python book? I appreciate all the advice I can get. thank you.

reddit.com
u/Dependent_Apple_2137 — 10 hours ago

Python learning for begginers

Hey guys , I want to start learning Python but I don't know from where to start. Do you have an idea or a free website where I can actually learn python in stages and then after each small lesson to make a quiz or a practical test.. I feel like for me that's the best way to learn faster and to be productive.

Thank you

reddit.com
u/Artistic_Cobbler3688 — 21 hours ago

Youtube programmers

Does anyone know why there are so many generic youtube programming channels with the same AI generated thumbnails, long boring videos and constantly promoting expensive websites? It is so hard to tell if one is genuine or not :(

reddit.com
u/Popular-Decision-202 — 23 hours ago

Built a STT → LLM → TTS pipeline in Python as a self-taught Indian developer — what would you have done differently?

Been working on a voice AI assistant for a few months as a self-taught developer from India. Here’s the stack I landed on and the problems I ran into — curious what fellow Indian devs would change.

Stack:

∙	Vosk for offline STT

∙	Google Gemini Live API for response generation

∙	edge-tts for voice output

Problems I actually faced:

Biggest one was pipeline latency. Getting Vosk transcription → Gemini response → edge-tts playback to feel natural under 2 seconds was harder than expected. Ended up building a custom queue to prevent audio overlap.

Second was wake word accuracy. Vosk misfires around 8-10% of the time in noisy environments. Considering switching to Whisper but worried about latency tradeoff.

Genuine questions for this community:

∙	Would you swap Vosk for Whisper despite the latency hit?

∙	Any better approach to t he audio queue problem?

∙	Is there a lightweight persistent memory solution worth trying?

Building this solo from India with no mentor or team — would genuinely appreciate input from experienced devs here. 👇

reddit.com
u/Ronak-Aheer — 24 hours ago
Week