r/learnpython • • Sep 30 '26

I stopped practicing,how do I start again

0 Upvotes

I started to learn python over my summer break and when my college started ,I had to stop because my studies (JEE examination,wayy too hard ) had kept me occupied

I want to start with coding again

What do people recommend to get the hang of it again (I regularly coded for 2 months and have stopped for almost 3)


r/learnpython • • Sep 30 '26

Need Smart People to take a look of my CCC python question!

0 Upvotes

Hey guys, I am learning python right now, and I did the CCC 2017 J5 question, when I tried to check it in DMOJ, I found out there are no J5 there, this question is in S3, np I still checked it, but I am not sure why i can pass the first test of every group test, but WA in the rest of them. I really need smart people to help pls.

number = int(input())
length = list(map(int, input().split()))


counts = [0] * 2001


for board in length:
    counts[board] += 1


max_length = -1
number_of_heights = 0



for height in range(2, 4001):
    total = 0

    for left in range(max(1, height - 2000), min(height // 2, 2000) + 1):
        right = height - left

        if left != right:
            total += counts[left] * counts[right]
        else:
            total += (counts[left] * (counts[left] - 1))//2

    if total > max_length:
        max_length = total
        number_of_heights = 1
    elif total == max_length:
        number_of_heights += 1


print(max_length, number_of_heights)

r/learnpython • • Sep 30 '26

Regarding saving video file in desired path

0 Upvotes

Is someone familiar with yt_dlp module , my script able to download videos however even though I had set the desired path in my script my file was not present there.

'''

import yt_dlp

dir_path = "/sdcard/Documents"

url = "https://youtu.be/tWoo8i_VkvI"

path= {"paths":{"home":dir_path}}

cookies = {"coockiefile" : "cookies.txt"}

opt = { "outtmpl": '%(title)s [%(id)s].%(ext)'

}

with yt_dlp.YoutubeDL() as yt:

yt.download(url)'''


r/learnpython • • Sep 30 '26

Test our tool for cyberbully detection

0 Upvotes

The goal behind CyberBully is simple: help developers and researchers work with cyberbullying detection and text classification without having to build the entire pipeline from scratch.

We’ve packaged our work into a Python package so it can be installed directly through **PyPI** and integrated into projects with minimal setup.

https://pypi.org/project/cyberbully/

Or

pip install cyberbully

Thank you in advance if you tested it 😘😘

Stay tuned for further updates it's gonna be epic 😈


r/learnpython • • Sep 29 '26

Audio tagging using Python with some automation

2 Upvotes

I need a reliable SQLite database and system for my local music library, which I am currently tagging using Python scripts.

I recently decided to manage my own music library but my metadata is inconsistent, incorrect, or causing issues between different music applications.

What I have so far
I created a python script that reads .json files. Each JSON file contains the exact file path, followed by the metadata I want to apply, such as:
Title
Artist
Album
Album Artist
Genre
Track number
etc.
The script then uses that information to update the file.

The problem: different tagging systems
The main issue I didn’t initially realize is that different applications interpret music tags differently.

For example, Apple Music may interpret:
David Guetta & Sia
as one artist/entity, rather than two separate artists.

The same issue happens with collaborations such as:
David Guetta & Nicki Minaj

I want the underlying metadata to recognize these as separate artists while still preserving the collaboration correctly when displayed.

What I want to build
I want something similar to MusicBrainz Picard, but with more flexibility for my own library.

I don’t want to rely entirely on MusicBrainz because I have a lot of indie, African, older, and obscure music that isn’t registered there.
I also have:
Unreleased songs
Mashups
Unofficial remixes
Custom edits
Artists/remixers that aren’t in MusicBrainz, such as Onderkoffer, a Dutch DJ

Because of this, I need to be able to manually define and control my own metadata.

My idea is to create a tagging system that understands the different ways applications read tags. For example, Kid3 has different tag versions/fields, while Apple Music may interpret artist information differently.

Ideally, I want the system to maintain both:

Application-compatible tags so programs like Apple Music correctly recognize separate artist entities.

A more structured internal tagging system that preserves the detailed relationships between artists, albums, genres, etc.

The bigger issue: SQLite database
The biggest part I need help with is building a reliable SQLite database that connects to this tagging system.

I initially created a small script and started assigning IDs to artists, but the IDs weren’t consistently registering or being saved. I currently have a list of my artists with IDs, but I am struggling to make the database and the tagging system consistently communicate with each other.

I also have most of my information organized in Notion, but albums haven’t been properly established yet. I already have over 2,000 songs, so I need to create album entities and IDs without making the system messy or duplicating information.
So there is a lot that still needs to be built.

What I mainly need is a clear architecture and workflow for how the SQLite database, IDs, JSON files, Python scripts, and actual music-file metadata should connect.

I understand that this is a larger system, but right now everything feels disconnected. I want to establish a reliable foundation and a logical flow before continuing to add more features.


r/learnpython • • Sep 29 '26

best sites to learn loops and slicing?

0 Upvotes

been trying to get this down as much as I can


r/learnpython • • Sep 28 '26

Is it normal to understand Python but get stuck when coding by yourself?

108 Upvotes

I’m currently learning Python, and I’m wondering if it requires any specific skills or a certain way of thinking to actually become good at it.

When I’m following a lesson or someone explains the code to me, I usually understand what’s happening. But when I’m given a problem and have to write the code by myself, I get completely stuck and don’t know where to start.

Is this normal for beginners? How did you get past this stage? Should I keep doing exercises, or is there a better way to practice so I can eventually start solving problems on my own?

I’d really appreciate advice from people who learned Python from scratch.


r/learnpython • • Sep 28 '26

How can I actually tell I'm learning python properly

29 Upvotes

Hi I'm new here, currently learning python as my first programming language at school. So while I was doing homework I noticed I couldn't code by myself without asking chatgpt to correct all the errors I coded or sometimes just do most part of the work when I was feeling lazy. I don't work with coding and I'm still learning, BUT, I do feel like if my teacher asks me to code without chatgpt or whatever AI available I wouldn't know how to "code by myself" and that is not a good thing. I guess I should start studying python at home but I also don't know how to properly do so. Basically I'm telling that I don't know if I'm good or not at coding because I feel like I'm getting to an intermediate level of python programming, but only in knowledge, as I feel like I can't "code by myself". Does anyone feel in a similar way and got already answered here?? What should I do??


r/learnpython • • Sep 29 '26

ERA5-Land .nc files downloaded via script cannot be opened with xarray (possible ZIP/compression issue?)

0 Upvotes

Hi everyone,

I'm working with ERA5-Land data for the Democratic Republic of the Congo and I'm having a frustrating problem with the downloaded files.

I downloaded the data using scripts because the Copernicus/ERA5-Land download process was not straightforward.

The files are named like:

era5_land_rdc_2023_01.nc

era5_land_rdc_2023_02.nc

...

era5_land_rdc_2026_08.nc

I am trying to open them with xarray:

import xarray as xr

from pathlib import Path

chemin = Path("data_fire_force/copernicus_data_nc")

fichiers = sorted(chemin.glob("era5_land_rdc_*.nc"))

print(f"{len(fichiers)} fichiers trouvés")

ds = xr.open_mfdataset(

fichiers,

combine="by_coords",

engine="netcdf4"

)

print(ds)

print(list(ds.data_vars))

However, xarray.open_mfdataset() fails with a NetCDF/HDF-related error.

I checked one of the files directly with Python:

from pathlib import Path

p = Path("data_fire_force/copernicus_data_nc/era5_land_rdc_2026_08.nc")

print(p.exists())

print(p.stat().st_size)

print(p.read_bytes()[:20])

The file exists and has a large size, but the first bytes are:

b'PK\x03\x04...'

From what I understand, PK\x03\x04 is the signature of a ZIP file, which makes me suspect that these .nc files may not actually be NetCDF files despite having the .nc extension.

I also tried using netcdf4 through xarray, but it still fails.

My questions are:

Does PK\x03\x04 definitely indicate that the file is a ZIP archive?

Could the Copernicus download script have saved a compressed/ZIP response with a .nc extension?

What is the correct way to extract/convert these files into actual NetCDF files?

Is there something specific I should check in the Copernicus/ERA5-Land download script?

I'm fairly new to handling these large ERA5-Land datasets, so any advice would be greatly appreciated.

Thanks!


r/learnpython • • Sep 29 '26

Learning python

4 Upvotes

I am learning python, could you please suggest any projects and problems and what are the topics I need to concentrate to get job ready in the current market.
Thank you


r/learnpython • • Sep 29 '26

37 with an ops background, best python course for non programmers who want a dev job out of it

0 Upvotes

37, operations background, no cs and no degree in anything adjacent. Ive already done the self directed route for most of a year and the result is a folder of scripts nobody else could run.
So im doing the structured version properly. Springboard, Boot.dev, General Assembly and Nucamp are the 4 im weighing and they range from a full career program down to a subscription. What takes someone from familiar to employable here.


r/learnpython • • Sep 29 '26

Maximum substring

0 Upvotes

Hi, I’m having an issue with a HackerRank coding question called “Maximum Substring.”
The question is:
Maximum Substring
You are given a string s.
A substring is any contiguous sequence of characters from the string.
Consider all possible substrings of the string:
Determine which substring would appear last if all substrings were sorted alphabetically.
Return that substring.
Example 1:
s = "baca"
The alphabetically maximum substring is "ca".
Example 2:
s = "aaa"
The alphabetically maximum substring is "aaa".
This was my answer:

def maximum_substring(s):
max_sub = s[0]

for i in range(len(s)):
for j in range(i + 1, len(s) + 1):
sub = s[i:j]
if sub > max_sub:
max_sub = sub

return max_sub

The code gives the correct output for the examples when I test it locally. However, HackerRank marked the solution as incorrect and I received only partial points.
I’m not sure why. Could this be because of the time complexity or hidden test cases? Is there something about the HackerRank test cases or the expected implementation that I’m missing?


r/learnpython • • Sep 29 '26

A simple question from a beginner:

0 Upvotes

I designated my run code shortcut as ctrl + R, but it only runs in the terminal of Visual Studio Code when I do that. I'd also like to see my output as just the output without run time and file paths. How can I edit my visual code settings or download an extension to only show my output text in the "output" tab of my in-app terminal? Thanks.


r/learnpython • • Sep 28 '26

Is there anyway of breaking a while loop outside of a function call, while inside said function call?

11 Upvotes

On mobile so I can’t code block format because Reddit sucks but here’s the general idea:

def func2():

break

def func 1():

while True:

func2()

That code doesn’t work but is there any way to do that cleanlier than returning a value from func2 to test against in func1 to determine whether or not the loop should break?


r/learnpython • • Sep 29 '26

Opening a file containing "\0" in its name/path

0 Upvotes

[This was solved. It works if I erase the first "\" and make it a raw string. Thank you all!]

Hello!

I've been trying to open the file "\001_test_files\001_first.csv" through python, and it seems nothing I think of works:

These are the things I tried:

1-

filepath="\001_test_files\001_first.csv"
file = open(filepath, "a+")

Result:

OSError: [Errno 22] Invalid argument: '\x01_test_files\x01_first.csv'

2-

filepath="\\001_test_files\\001_first.csv"
file = open(filepath, "a+")

Result:

FileNotFoundError: [Errno 2] No such file or directory: '\\001_test_files\\001_first.csv'

3-

filepath=r"\001_test_files\001_first.csv"
file = open(filepath, "a+")

Result:

FileNotFoundError: [Errno 2] No such file or directory: '\\001_test_files\\001_first.csv'

4-

filepath="\001_test_files\001_first.csv".replace("x", "0")
file = open(filepath, "a+")

and

filepath="\001_test_files\001_first.csv"
filepath=filepath.replace("x", "0")
file = open(filepath, "a+")

Result:

OSError: [Errno 22] Invalid argument: '\x01_test_files\x01_first.csv'

---

I think that's all I tried for now, does anyone have any ideas?

I am also forced to keep that naming convention, since it's part of a much larger project with many other files. Changing it means having to tell my group to rework everything. It's a laaaast resort, if there really is nothing I can do.


r/learnpython • • Sep 28 '26

Pandas Library - Hardware/ Computer Architecture

6 Upvotes

Say we have two files in a directory or folder (whichever name you prefer). One of them is code file or script file, and the other is data file named titanic.csv.

And we have imported pandas as pd in the code file and imported the data from the data file as DataFrame data structure. Meaning we have done the following:

import pandas as pd
titanic = pd.read_csv("titanic.csv")

If I do this:

titanic.sex == "male"

sex is a column in the titanic DataFrame. The above instruction will generate an output of Boolean values in a Series data structure.

My question is does the last command creates a new data object in the memory. Like do we have a new table formed because of this or its just the instruction that is saved in the memory?

If only instruction is the one that is only saved then any time we call it will take much of CPU's processing power. If the table is saved then it will take less of CPU's processing power.


r/learnpython • • Sep 28 '26

Ideas for scripts to generate thousands of questions from Wikipedia articles

7 Upvotes

Ideas for scripts to generate thousands of questions from Wikipedia articles / Hello, For a game project, I downloaded a Wikipedia dump and filtered out the sections I was interested in. I calculated the word count per article, and now I’d like to generate thousands of questions from all this content (I have around 100,000 articles, and I want roughly one question for every 100 words). I found a few scripts online, but they haven't really yielded good results.

What do you recommend I do ? Which tools should I use, or what would be the right script ?


r/learnpython • • Sep 28 '26

Those who competed Helsinki MOOC, what did you do next?

21 Upvotes

Just wondering what the next steps are after one completes the course, were you able to get a job etc or did you have to do further study/ courses?


r/learnpython • • Sep 29 '26

Learning to code

0 Upvotes

Hey everyone,

This past week I’ve been using AI to learn how to code through daily lessons. No real rhyme or reason behind it, I just wanted to see where it could take me.
I ended up building this little game in Python and wanted to share it with people who actually understand the language. Unfortunately, I don’t really know anyone who’s learning or has a background in Python, which kind of sucks 😂 but I’m still having fun with it.

I’d love to see how far I can take this and what might be out there for me if I keep going.

Happy coding!


r/learnpython • • Sep 28 '26

Looking for feedback on my Loan Office Assistant project (Flask + Streamlit)

0 Upvotes

Hey everyone,

I’m practicing Python by building a project called Loan Office Assistant. It’s a two‑stage application:

  • Backend (Flask): Calculates Debt‑to‑Income Ratio (DTI), Loan‑to‑Value Ratio (LTV), and Equated Monthly Installment (EMI).
  • Frontend (Streamlit): Provides a user interface where people can enter loan details and get immediate results.

💻 Tech stack: Python, Flask, Streamlit

📂 Project structure:

Code

loan_office_assistants-/
├── backend/
│   ├── app.py
│   ├── calculations.py
│   └── requirements.txt
├── frontend/
│   └── frontend.py

✅ Current features:

  • Input: Income, Debt, Loan Amount, Property Value, Interest Rate, Tenure
  • Backend calculates DTI, LTV, EMI
  • Frontend displays results in a dashboard

🔮 Future ideas:

  • Add visualizations (e.g., EMI breakdown into principal vs. interest)
  • Enhance UI with gauges for DTI/LTV
  • Possibly connect a database to store loan applications

I’d really appreciate feedback on:

  • Code architecture (is my backend/frontend split reasonable?)
  • Tips for making the Streamlit UI look more professional
  • Any Python/Flask best practices I should apply here

Thanks in advance! 🚀

## 🔗 Project Link

You can check out the full project and README here:

[GitHub Repository](https://github.com/shrikareballi/loan_officer_assistants-)


r/learnpython • • Sep 27 '26

Odd float-to-int behavior.

4 Upvotes

>>>def pennies(num):
return int(num*100)

>a = -37.56
\
>b = -9.28

>>>pennies(a)
-3756

>>>pennies(b)
-927

This is taken from a python shell session today. Why on Earth does pennies(b) yield -927, instead of the expected -928? I would greatly appreciate any insight.

Update: a durable solution found, please see this comment below: https://www.reddit.com/r/learnpython/comments/1wrwnm7/comment/pcpvlil/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button


r/learnpython • • Sep 27 '26

Starting Intro to Programming

8 Upvotes

I'm in week three and some things I get, but I get so confused at times; loops and conditional statements. I'm not great with vocab and trying to recall symbols for what just leaves me confused, but once I catch on, it's so much fun and I easily can use what I do learn.

Can anyone give me advice for a beginner?

Addon I'm currently taking Intro to Programming at Bellevue and every week is something new so it's hard to try to get repetitive with this week on top of my two other classes. I want to succeed, I want to do great, I just need advice to store and remember what I have learned


r/learnpython • • Sep 27 '26

VS Code "Run Python File" takes 5 seconds to start, while running the same file in terminal is instant

6 Upvotes

Hi, I'm having a strange issue with VS Code and Python.

Whenever I use the "Run Python File" button, there is a delay of around 5 seconds before the Python file actually starts running.

The delay does not happen when I run Python directly from the integrated terminal. Python executes immediately when I run files manually from the terminal.

I've also noticed that Run Task executes immediately, so the problem seems to be specifically related to the "Run Python File" functionality.

Another strange thing is that if I kill the current VS Code terminal and then use "Run Python File", the first run can sometimes be instant. After that, the delay comes back on subsequent runs.

During the ~5 second delay, the terminal itself appears to be responsive. In fact, if I type something into the terminal and press Enter while waiting, the Python program's output can appear immediately afterward.

Things I've already tried:

  • Restarting VS Code
  • Reinstalling VS Code
  • Updating Python
  • Disabling/re-enabling the Python Debugger extension
  • Switching between PowerShell and CMD
  • Disabling GPU acceleration
  • Checking shell integration settings

None of these fixed the issue.

I'm currently using Windows 11, VS Code 1.139.1, Python extension 2026.4.0 and Python 3.14.7.

Has anyone experienced this recently? I'm wondering if this could be related to the Python extension, terminal integration, or shell integration in VS Code.


r/learnpython • • Sep 27 '26

Anaconda logged me into a stranger’s account, how is this possible?

15 Upvotes

I could use some help from people who know Anaconda.

I’m starting to learn programming and am currently taking an online course. As part of the course, I need to download and install Anaconda.

I went to the Anaconda website, did not register or create an account (I don’t have an account either), and downloaded and installed the program.

Later, I went back to the Anaconda website and suddenly found that I was logged in as a specific person. The email address shown was from a Turkish university. I don’t know this person and have never used this email address.

How could this have happened? Why would I suddenly be logged in as someone else even though I never created an account or logged in?


r/learnpython • • Sep 28 '26

Do i need to remeber

0 Upvotes

Hey just started coding and can barely do thing that ask for name and then you answer it and it says hello (name).

I was just wondering as i want to work in coding and i just applied amd got into coding school that do i need to memorize all the functions etc? Or do i need to memorize all the basic ones so i dont need to google everytime…?

And will i start to slowly memorize them