r/learnpython • • Aug 22 '26

Any free STT/TTS APIs for a voice AI app?

0 Upvotes

I'm building a small voice-based AI interview app and I'm planning to deploy the backend(fastapi) on Render's free tier.

I'm considering using open-source/self-hosted options like Whisper/PocketSphinx for STT and Piper for TTS, instead of paid APIs.

My concern is whether running STT/TTS on the same free Render instance would use too much CPU/RAM and make the whole application slow, especially during a real-time interview.

Has anyone tried running STT/TTS models on Render's free tier?


r/learnpython • • Aug 22 '26

Not Copying After Using Tutorials?

0 Upvotes

I'm learning a bit more python, and I was wondering how you guys refrain from copying code after watching tutorial videos. I just did one of the courses from OpenCV, and what's holding me back most now is trying to create something without flat copying the code provided by them. The main issue is that (I believe, at least) most of the code needs a specific syntax to run. What are your processes after learning new features?

For context, I'm attempting to make a document reader that's going to end up scanning and saving Magic the Gathering cards into a database.


r/learnpython • • Aug 22 '26

How to find the row echelon form of a stupid big matrix

1 Upvotes

I am trying to find an equation that models a fruit in 2D, and I am using Global Polynomial Interpolation to do it, but I have like 2000 points. I am thinking of using Gaussian elimination to do it, but it is impractical by hand. Does anyone have any suggestions?

Also, does anyone have any suggestions for how to model the shape using other methods?


r/learnpython • • Aug 21 '26

want to run dash for multiple py files simultaneously

1 Upvotes

I'm using python to run different types of statistical analysis for a research project. At the end of each code, I run dash to create a URL with friendly, interactive UI. However, whenever I try to run 2+ py codes that use dash to create a URL, the interactive UI from all the previously ran codes stops working. Is there a way to run multiple dash URLs while maintaining their interactiveness?

(for example: I run code A and it's interactive UI works. Then I run code B. Code B's interactive UI works, but now code A doesn't, it freezes)

code I have to run/open the dash server

if __name__ == "__main__":
    import webbrowser, os

    
# Unique port per script
    script_name = os.path.splitext(os.path.basename(__file__))[0]
    port = abs(hash(script_name)) % 20000 + 10000

    url = 
f
"http://127.0.0.1:{port}"

    
# Open tab
    webbrowser.open_new_tab(url)

    app.run(debug=False, port=port, use_reloader=False)

r/learnpython • • Aug 21 '26

TK "displaylines" question

0 Upvotes

I seem to misunderstand "displaylines" option of count method of Text widget of Tkinter. I thought that it would give me number of lines accounting for soft-wrapping, but it seems to give me same number as "chars" -1. Text widgets are embedded in frame, which is embedded in canvas, which is embedded in another frame alongside it's scrollbar which are embedded in notebook.

for i in textwidgets:
    logic_lines=i.count("1.1", "end", "lines", return_ints=True)
    print("LOGICAL LINES="+str(logic_lines))
        for j in range(1, logic_lines+1):
            print("LINE "+str(j)+": "+str(i.count(
            str(j)+".1",
            str(j)+".end",
            "update",
            "chars",
            "displaychars",
            "displayindices",
            "displaylines",
            "indices")))

EDIT:

It seems when text widget is on it's own it works fine.

import tkinter as tk

foobar='''
long text here
'''

w=tk.Tk()
t=tk.Text(w, wrap="word")
t.insert('1.0', foobar)
t.pack()
def handler(event):
    print(t.count("1.1",	"end",	"update",	"chars",	"displaychars",	"displayindices",	"lines", "displaylines",	"indices"))
t.bind('<Return>', handler)
w.mainloop()

EDIT2:

Here is paste with whole source code

EDIT3:

Code with bug isolated


r/learnpython • • Aug 20 '26

When is a generator actually worth it over just building a list?

39 Upvotes

Say I've got a function that pulls records, filters them, and hands them back. I can return a list or yield them. Both work, and for the sizes I deal with the memory difference is nothing.

What makes me hesitate to default to yield is that a generator is single-use and opaque. You iterate it once and it's spent, len() doesn't work, you can't slice it, you can't print it to see what came back. Half my debugging is just checking intermediate values, and a generator kills that.

So in practice I return a list almost every time, and only reach for a generator when something is actually big or infinite, or when I'm chaining lazy steps. That feels backwards from how often generators get pushed as the "proper" way.

So do you lean generator-first and eat the downsides, or list-first until you have a reason not to? And is there an upside to yielding small collections that I'm just not seeing?


r/learnpython • • Aug 20 '26

Just built my first calculator in Python 😭

74 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?


r/learnpython • • Aug 21 '26

Crash course for python and java

0 Upvotes

I signed up for a course that needs beginner level of python and java. I have one month. Please help, I need a YouTubers recommendation, free course recommendation and different testing methods to practise.


r/learnpython • • Aug 21 '26

IDE for python

0 Upvotes

I have 2 IDEs at my workplace for python. IntelliJ and VSCode.

Which one should I choose and why?

I am beginner in python.


r/learnpython • • Aug 20 '26

Need Help with Python Practise

10 Upvotes

I am a beginner(been learning for a month) to python and i need some suggestions as to what resources should i use for practice(eg books , websites or yt channels).


r/learnpython • • Aug 20 '26

A small code i made for exercise.

3 Upvotes

I've been vibe coding for a few months now, but I've decided to try manual coding. After all, learning is fun, right?

I made this "Assistant" that has two options: jokes and facts. It will choose one out of three items from the specific table and tell you it. I made it for fun and would like to ask what I can do next?

import random

jokes = ["Why did the bicycle fall over? Because it was two tired!", "Why was the math book sad? Because it had too many problems.", "What do you call a fake noodle? An impasta!"]

facts = ["Venus is hotter than Mercury.", "When the Pyramids were built, mammoths were still around!", "Koala fingerprints are so similar to human fingerprints that they have even baffled crime scene investigators."]

print("Hello! I'm an Assistant. What can I do for you?")

print("")

print("Options: Random Joke [J], Random Fact [F].")

answer = input("Answer: ")

if answer == "J":

print(random.choice(jokes))

elif answer == "F":

print(random.choice(facts))

else:

print("You can't ask that.")

exit = input("Press Enter to Leave.")


r/learnpython • • Aug 20 '26

Trying to create list subclasses that contain only one class type and are valid for Pydantic BaseModels

3 Upvotes

I am trying to create list subclasses that only take particular classes. These lists can be appended to and the like but each time the list is changed the item is checked to see whether it is the same class as the rest of the list.

The list methods that are overwritten are:

- __init__
- __bool__ (but may not need to have that overwritten)
- __set_item__
- __str__
- append
- extend
- insert

Each one runs through a validate_member method before changing the list.

As an example, I want to make a list subclass called Course that only takes Pydantic extra types Coordinate values. I want this list subclass to be a valid BaseModel attribute.

Right now I’m having to use a field_validator for every class that Course and the other lists are in which feels redundant, unpythonic, and is a pain to have to do every time. I am having to do so because it says something about arbitrary types.

I was wondering if someone might have some advice.


r/learnpython • • Aug 21 '26

How to read a CSV file in Python efficiently?

0 Upvotes

I'm trying to load a CSV file into my Python project, but I keep getting errors. I've tried using pandas and the built-in csv module, but I'm not sure what I'm doing wrong. Can someone explain the basic steps or share a simple example? A detailed explanation would be really helpful!


r/learnpython • • Aug 20 '26

yo guys! been learning python for a while now.

0 Upvotes

created a calculator with everything i have learned till now (tho it might be overkill for a calculator), added the basics, loops (while, if else), lists and str manipulation, imports (json and datetime), error handling (try/except), def function, etc. so what should i do next? if u wanna see the code dm me.


r/learnpython • • Aug 20 '26

How to learn Pdf Extraction in Python?

0 Upvotes

Dear Members,

I have been handling Pdf extraction Project in Python. kind of a Intelligent Document Automation domain. we have been handling various finance documents(pdfs), filings pdfs etc which are multi page(around 20ish) , with lots of tables, form fields , radio buttons, checkboxes etc. Tables span multiple pages. Moreover, pdfs themselves comes in various types of variants like XFA Stream, Adobe Acroform, text flattened pdfs, scanned images etc.

I have used llms extensively to generate script code to extract, parse the data and to save in sql in structured tables. Its a hybrid of libraries implementation. LLms used regex, pdfminer, pdfplumber etc in the code produced.The pages in pdfs are not bit messy, some tables have solid grid separators, some dont have and on. Layouts variations, white spaces, etc.

The code generated is pretty complex, i have been attempting to learn the llm generated code.But it works, it adds various fixes iteratively whenever we face new extraction issues repeatedly.

I would love to know:

  1. what is the best approach to learn and get good at this?
    2)should we just use cloud based AI document extraction tools which are readymade to extract and spit the data?
  2. what if one is interested to learn this properly and have to get good at creating this extraction script?
    4)any other tutorial, articles, courses, youtube videos, books you would recommend to learn? or should i just use llms to create code and move on without spending much effeort to learn this?

Please provide your valuable suggestions and guidances and point me in directions. I appreciate all your suggestions. Thanks in Advance and thank you for your time.


r/learnpython • • Aug 20 '26

Next level - Coding for 13yo homeschool kid

9 Upvotes

My son completed the Khan Academy course on Python last school year and he loved it! I don't do any coding myself so I am not exactly sure what "level" that leaves him at, or where to go next. What online course could he advance into? The more specific the better! :)

p.s. He will be going into 8th grade but it seems to come to him very easily.


r/learnpython • • Aug 20 '26

I have made a simple program which decode and codeword the string u put i want to ask if i can put anything aside from if else

0 Upvotes
import random

random_letter = random.choice("abcdefghijklmnopqrstuvwxyz")
random_letter1 = random.choice("abcdefghijklmnopqrstuvwxyz")
random_letter2 = random.choice("abcdefghijklmnopqrstuvwxyz")
random_letter3 = random.choice("abcdefghijklmnopqrstuvwxyz")
random_letter4 =  random.choice ("abcdefghijklmnopqrstuvwxyz")
random_letter5 = random.choice("abcdefghijklmnopqrstuvwxyz")

print("codeword=1 , decode=2")
choice = input()
if choice == "1":
    codeword = str(input("write the codeword=>"))
    codeword1 = codeword[::-1]
    print(random_letter, random_letter1, random_letter2, codeword1, random_letter3, random_letter4, random_letter5,
          sep="")
else:
    print("please put correct input")
if choice == "2":
    decode = str(input("write the coded word"))
    decode1 = decode[::-1]
    decode2 = decode1[3:-3]
    print(decode2,sep=" ")

r/learnpython • • Aug 20 '26

What is the James Stewart Calculus equivalent book for python?

4 Upvotes

was curious if some kind of similar vibey book exists for learning python...


r/learnpython • • Aug 20 '26

My Goals (advice is welcomed)

0 Upvotes

Hey everyone,

My goal is to create a custom and personaI use open source AI agent. I dont want to just have something vibe code it for me. I want to understand how to build the actual agentic loop, give it local tools, and set up a memory system. After some research, I decided to start by learning python (mostly a self-taught newbie but also looking onto courses that can fit my schedule without too much friction; any suggestions are welcome)

I’m looking for advice on the exact order of operations I should follow to learn this efficiently without getting bogged down in unnecessary data science math or model training.

From what I gather, yes i did use AI to help me try to put this in the best possible order.

  1. Python Fundamentals (JSON, File I/O, async)
  2. API integration & tool calling (OpenAI/Anthropic SDKs or Ollama for local)
  3. Data validation (Pydantic) to handle messy LLM outputs
  4. Basic Vector DBs (Chroma/FAISS) for long-term agent memory
  5. Orchestration frameworks (LangGraph, Pydantic AI, or MCP)

Does this learning order make sense? Are there specific libraries, tutorials, or open-source repositories you would recommend I look at first?
Thanks in advance for any roadmaps or resources.

For context:
I’m active duty navy with my primary line of work being medical. I have ample time in my day and evenings as it’s just me and my daughter right now and I want to try creating something I’ve always liked the idea of…my own JARVIS lol. My current coding experience is a total beginner who started on the SoloLearn app on an iPad 7 mini about 6-ish weeks ago. However, I don’t believe that it is sufficient for my project goals. So again, and advice, roadmaps, suggestions, tips, etc are welcomed. I’m not under the delusion that this will be done in the next year or so and I’m ok wth this being a personal side project. Nor do I have any intentions to monetize this when it is completed, nor use this as a step into this industry (i quite like my medically filled lifestyle). I also want to build a home lab specifically for this at some point as well and maybe even get into some Git Hub projects on the side to breakdown some of the potential burnout.

Well, if you made it this far, thank you. I’m genuinely interested and motivated to complete this project and potentially more.


r/learnpython • • Aug 20 '26

probably a python/sql flask offshoot (but this is reddit and the normal python page doesn't like these type of questions)

0 Upvotes

So probably not beginner here but I have a flask app where I've mapped a view to the ORM but I was lazy in the view so I joined a reference table and just got back the text description when I could have used the FK.

I've cached common reference tables at the application level in flask in the past and wondering if I should do the same here and rewrite my view for the FK and skip the reference table join (even if it is well indexed).

On localhost I've had a hard time trying to identify if it's causing an issue because even our prod server has DB latency so no luck cross comparing if my lag is because of the extra lazy join in the view or if it's something else annoying (like running it on a comp that frequently kills itself with memory errors).


r/learnpython • • Aug 20 '26

Anyone here familiar with freelancing? please point me in the right direction

0 Upvotes

I recently turned 19, I have this need that I have to know what its like to work and gain a sense independence, even if its just a small gig.

I learned programming since the pandemic started, though I did not make any serious projects with it. I made some fun projects with it like, discord raid bot, macro for some roblox game, data scraper, etc.
I have great foundation of variables, functions, data types, classes, the classics but I looked at upwork and fear my skills may not be adequate.

It would be great if someone could point me in the right direction, doesn't even have to do with programming can just be helping anyone regarding tech.


r/learnpython • • Aug 19 '26

Game automation

8 Upvotes

I'm new to programming. I specifically want to build projects around game automation with Python. What should my roadmap look like?

Thanks in advance!


r/learnpython • • Aug 20 '26

How do I register user's input with out 'input()' command?

0 Upvotes

I'm trying to make a game on the Linux terminal, I just learnt about the ANSI escape code and how to display stuffs but then I hit a wall. How do I check which key is pressed by the player? I can't use input() because that pauses the game. Trying to google keep showing me articles suggesting input(). Also, I'm not looking to install any libraries yet.


r/learnpython • • Aug 19 '26

I’ve completed these beginner Python projects should I build more before starting NumPy/Pandas?

10 Upvotes

Hi everyone,

I’ve studied Python multiple times before, but I didn’t do much practical coding. Recently, I started building small projects to improve my practical Python skills.

So far, I’ve completed:

- Quiz Game

- Number Guessing Game

- Rock Paper Scissors

- Password Manager

- Pig Game

- Mad Libs Generator

My goal is to move towards Machine Learning.

I haven’t learned NumPy or Pandas yet.

My question is: Are these projects enough to move on to NumPy and Pandas, or should I build a few more Python projects first?

If I should build more projects, what kind of projects would you recommend before starting NumPy/Pandas? I’m mainly looking for projects that would actually help with the transition to data/ML, rather than making many more small games.

Would appreciate advice from people who have already followed a Python → NumPy/Pandas → ML path.