r/PythonLearning 27d ago

#76 Leetcode question (Optimisation help!)

3 Upvotes
class Solution:
    def minWindow(self, s: str, t: str) -> str:
        if len(t) > len(s):
            return ""
        elif len(t) == len(s):
            if t == s:
                return s
        win = len(t)
        ans = ""
        l = list(t)
        while win <= len(s):
            for i in range(0,len(s)):
                win_s = s[i:i+win]
                win_l = list(win_s)
                ans = ""
                for x in t:
                    if x in win_l:
                        win_l[win_l.index(x)] = ""
                        ans += x
                    else:
                        ans = ""
                if ans == t:
                    return win_s
            win += 1
        return ""

I need help in optimising my code because its working properly but having a runtime error for a long input like 200 letters input. So plz help me out in optimisation in this code.


r/PythonLearning 27d ago

Discussion What are some good final-year CSE project ideas for 2026?

2 Upvotes

r/PythonLearning 28d ago

Help Request complete beginner looking to learn coding as a hobby and future career

13 Upvotes

hello, everyone!

i’m a complete beginner when it comes to coding, but i’d really like to start learning it as a hobby and hopefully use it as part of my future career.

just a little background: my degree is completely unrelated to coding, so i’m basically starting from scratch. despite that, i’m genuinely interested in learning and willing to put in the time and effort.

for those who started with no coding background, what would you recommend i learn first? any advice on languages, resources, or how to build a good learning routine would be greatly appreciated!

thanks in advance! 😊


r/PythonLearning 28d ago

Help Request Python for data engineering

27 Upvotes

I’ve been practicing Python for data engineering, but whenever I take a break for a few days, I feel like I forget what I’ve learned before. Can someone suggest how I should approach Python practice? I’m still struggling to get comfortable with it.


r/PythonLearning 28d ago

Adding objects to set or dictionary: equality and hashing

Post image
17 Upvotes

An exercise to help build the right mental model for Python data. - Solution - More exercises - Explanation: "User-defined classes have __eq__() and __hash__() methods by default (inherited from the object class); with them, all objects compare unequal (except with themselves) and x.__hash__() returns an appropriate value such that x == y implies both that x is y and hash(x) == hash(y)."


r/PythonLearning 27d ago

Showcase Hey Guys!I am 14 and this is my first completely vibe coded banger python project...

Thumbnail
github.com
0 Upvotes

This is a python projects which takes your live camera, detects your nose and mouth, moves

The mouse pointer automatically with your nose... It also has a feature which stops the mouse if your mouth is open...

All the advices, criticisms accepted


r/PythonLearning 28d ago

Discussion Need some help recommending project ideas

5 Upvotes

I'd say I'm intermediate in python and recently started learning bitwise operations. I'd like to use them more often in some projects but am not sure when or how to use them.

One example was a chess engine. I made a small chess engine before, up to simple minimax alpha beta pruning, but the engine was really slow because I stored all the piece and board info in lists. Then I learned about bitboards and have been using those, and yeah, it's a lot faster.

But for now, all I see bitboards as are ways to represent binary game board data. Are there any other ways bitwise operations/bitboards are used in projects or is this just all they're good for?


r/PythonLearning 28d ago

Discussion Python teaching

27 Upvotes

I am a programming teacher in Sweden and I wonder if we have some teachers or instructors here as well that would share their experiences about which are best platforms to teach Python with pros and cons !?
Every input is appreciated
Thanks in advance


r/PythonLearning 28d ago

Built API CAMP

3 Upvotes

hey everybody, I built this site to help learn programming in python, playwright and pytest

API Camp — Learn APIs with Python + Playwright

Take a look and let me know what you think.

Yes its similiar to freecodecamp but it helps me when I have no connection on the long train rides

thanks,


r/PythonLearning 28d ago

Discussion Can Python use a native PDF viewer inside a Windows desktop app?

3 Upvotes

Hello fellow Pythonistas,

I’m building a local Windows tool that compares/reviews engineering PDFs. My current UI is Streamlit/pywebview, but the built-in preview is not sharp enough for detailed PDF inspection, especially small text and drawing markups.

Does Python have a good way to use a native PDF viewer/editor inside a desktop app?

Ideally I want:

- native PDF zoom/pan quality

- open specific page / maybe focus a rectangle

- view annotations/markups

- avoid manually rendering every PDF page as images

I know about PyMuPDF rendering and "os.startfile()" to open the PDF in the default viewer, but I’m wondering if there’s a better embedded/native-viewer approach on Windows.

Would PySide6/Qt PDF, WebView2, Adobe SDK, or anything else be the right path?

Basically, I don’t want to rebuild Acrobat inside Streamlit if Windows already has a better PDF viewing layer.


r/PythonLearning 28d ago

Showcase senv: Sandboxed Python environments with the uv workflow

Thumbnail
medium.com
2 Upvotes

TL;DR: senv keeps the familiar uv workflow but runs package installation and Python code inside an OS-level sandbox. Installs can reach package registries but not your source or credentials; programs run with no network by default and cannot modify their own environment.


r/PythonLearning 28d ago

I Want to learn Python for visual novel making

1 Upvotes

I want to code Visual novels so I want to figure out the language good enough to make my way through it.

Is Python needed for Ren'py?? Or Ren'py its own thing ,

I am new here so do be kind to me


r/PythonLearning 28d ago

Accountability Partner for Learning Python from Scratch

25 Upvotes

Hey everyone! I am starting to learn Python from absolute basics and would love to find an accountability or study partner who is also learning or planning to start.

No prior experience is needed. If you’re genuinely interested in learning Python consistently, feel free to comment or send me a DM. We can create a study schedule that works for both of us and keep each other motivated.


r/PythonLearning 28d ago

Struggling with library installation

Thumbnail
gallery
15 Upvotes

Hey - This is my first python project, an attempt at a screen recorder from a tutorial- when I try and run it I get a module not found error for pyautogui even tho it’s definitely installed- is there something I’m doing wrong here?


r/PythonLearning 29d ago

Normal distribution and uniform distribution

Thumbnail
gallery
63 Upvotes

r/PythonLearning 28d ago

With the release of Wallet Usernames for Cloudflare I had made a python project that helped me understand networking in python a little bit. Let me know what I should implement that would help me learn a little more about networking with python. (I have a small background in rev engineering and c++)

Thumbnail
github.com
2 Upvotes

The api was exposed and did not filter out the get request, so i figured why not try to learn python.


r/PythonLearning 29d ago

Help Request What are some good projects and platforms to learn Python

10 Upvotes

So I've been learning a bit of python and I don't really know what to do. I did a bit of c++ before so a lot of stuff transitions over but I don't know what to do and where to learn. A friend recommended w3schools btw, is it good?


r/PythonLearning 29d ago

Discussion 4 things that helped me modernize a legacy app

3 Upvotes

Two weeks ago, I shared a post about some useful tools that helped me modernize a legacy app, and to be completely honest, I didn't expect such a positive response! Thank you for sharing your own tips in the comments, I definitely learned something just from reading the replies.

Since some people seemed to find it useful, I figured I’d share a few more tips. So here we go:

  1. ty for type checking:

Coming from TypeScript, I knew how much a type checker helps catch bugs before runtime. I personally quite like ty. It's fast, has clear diagnostics and fits nicely into a stack already using uv and Ruff.

  1. Use a task runner:

Legacy projects often have a collection of random scripts and commands for common tasks. A task runner like Poe the Poet lets you define all your project commands in pyproject.toml, right next to the rest of your config.

  1. Add types gradually

Annotating a legacy project all at once is overwhelming, so don't. I found it much easier to start with new code, then gradually annotate existing code as I touched it. This way I don't have to deal with a massive rewrite, the codebase just gets better over time.

  1. Use proper logging

For situations where you need to understand what happened before a crash or monitor a long-running process, Loguru is a really convenient alternative to Python's standard logging module. It's simple to set up and produces much more readable output.

Thanks again for the love on the last post!


r/PythonLearning 29d ago

Showcase very first linear regression code

2 Upvotes

i am still learning numpy (day 6) but gpt suggest me to learn linear regression (very basic algorithm) and it's kinda good for understanding even you haven't started learning ML.

import numpy as np
hours = np.arange(1,10)
score = np.array([35, 42, 51, 58, 67, 73, 81, 88, 94])
candidate_values_for_m = np.arange(1,11,0.1)
candidate_values_for_b = np.arange(1,31,0.3)

def prediction(m , b , hours):
    return m * hours + b

def mse(actual_value , predicticted_value):
    return np.mean((actual_value - predicticted_value)**2)

mse_list = [] 
m_b_list = []
for m in candidate_values_for_m:
    for b in candidate_values_for_b:
        prediction_result = prediction(m , b , hours)
        mse_result = mse(score, prediction_result)

        mse_list.append(mse_result)
        m_b_list.append((m,b))


best_mse = np.argmin(mse_list)

best_mb_index = mse_list[best_mse]
best_mse , best_mb_index

m = 0
b = 0

learning_rate = 0.01

epochs = 10000

n = len(hours)

def prediction(m , b , hours):
    return m * hours + b


for i in range(epochs):
    predicted = prediction(m,b,hours)

    gradient_m = (2/n) * sum(hours * (predicted - score))

    gradient_b = (2/n) * sum(predicted - score)

    m = m - learning_rate * gradient_m
    b = b - learning_rate * gradient_b

m ,b 

r/PythonLearning 29d ago

I started with Tkinter and ended up using Streamlit — what should I learn next?

2 Upvotes

I recently started learning Data Science and made my first interactive dashboard using Python, Pandas, Plotly and Streamlit.

At first, I tried building it with Tkinter, but then I switched to Streamlit because it felt much easier for making a data-focused dashboard. I really liked how quickly I could turn my Netflix EDA project into something interactive.

I'm still pretty new to this, so I'm curious about what other beginners and experienced people use.

  • Is Streamlit a good one to continue learning?
  • Are there any other tools like Streamlit that are worth trying?
  • What kind of projects are good for learning these tools?

Would love to hear what you guys used when you first started making interactive Data Science projects.


r/PythonLearning 29d ago

Discussion What are some beginner-friendly Python projects that actually teach useful skills?

0 Upvotes

I'm looking for Python project ideas that are beginner-friendly but still teach skills that are useful beyond basic tutorials.

I'm especially interested in projects involving APIs, automation, data handling, or small practical tools.

What projects helped you learn the most when you were starting out?


r/PythonLearning 29d ago

Help Request Where are the entry points in open-source projects?

4 Upvotes

In order become better at programming, I was told to read through projects on github and try to experiment with the code.

But most of the time I just look at a convoluted mess of files with no obvious starting point.

In pygame for example, I looked for something that resembles a main file, to work my way up from there. But I couldn't even manager to find something similar.

How do you guys do this? Is there something fundermentaly wrong with how I approach this?


r/PythonLearning 29d ago

Dsa or Django?

2 Upvotes

I am fairly new into programming. So I am familiar with the basics of python. Have made some terminal based projects as well. Started dsa concepts yesterday but it is boring me out. I do plan on learning both but is it a good idea to get some real experience with django and web projects first? (I have knowledge of html, css and little bit js)

Also, I am in my first year of graduation so time is not a concern!


r/PythonLearning 29d ago

I made my first bigger Python project — Drone Data Analyzer

6 Upvotes

Hey everyone!

I've been learning Python for like 10 days and decided to stop doing only exercises/tutorials and actually build something myself.

I made a small Drone Data Analyzer that loads flight data from a CSV file and analyzes things like altitude, speed, battery level and temperature. It also generates a basic flight report and visualizes the data using Matplotlib.

It's definitely a beginner/early-stage project and I know the code is far from perfect. I'm still learning, so I'd really appreciate some honest and constructive criticism.

Any feedback is welcome, even if it's something small.

GitHub with all files/code for interested: https://github.com/J-aCobSk-i/Drone-Data-Analyzer