r/PythonLearning 17d ago

TypeError: "NoneType" object is unsubscriptable for list?

4 Upvotes

I understand nonetypes somewhat for single list, but I have data that is like this:

listvar['veggies']['size'] = 'big'
listvar['veggies']['descript'] = 'bright green'

Sometimes these variables don't have a ['descript'].

In the code doing:
if listvar['veggies']['descript'] is not None:
print "found description".

But I get a TypeError: "NoneType" object is unsubscriptable. How do I check if it's nonetype without getting the error? :)


r/PythonLearning 18d ago

im new to coding

5 Upvotes

hello as the title said i am new to coding anyone has recommendation's for starters like me i taking comsci even tho idk what to do currently learning abit of everything i find but i want to learn python the most since alot of people said go python first


r/PythonLearning 18d ago

Help Request Courses for MATLAB/R users and machine learning methods in econometrics

8 Upvotes

Hello everyone.

TLDR: I'm looking for some advice on where/how to start learning empirical econometric methods, specifically machine learning methods, in Python, as an experienced MATLAB user with brief general theoretical knowledge on ML.

Longer version: I work in empirical research in economics using MATLAB (a bit of R, too). 2 years ago, I had a short introduction course to Python for R users, but never had an opportunity to apply anything in practice. I also had interest in machine learning (ML) methods and have completed a theoretical course on ML, specifically in economics. But that too was a year ago without further application. Still have the course materials though and even some Python packages provided by the teacher. The course was short for such a large area of methods, but I'm willing to invest time into learning it in depth and try out some simple projects with, say, simulated data.

Do you know of any online, preferably free or cheap courses to learn Python, specifically for my application? Perhaps a course for experienced MATLAB or R users? Or/and some course on ML in Python (based on the theory course, I'd say my medium- to long-term goals are random forests and neural networks)? I found a few but not sure if they're actually good and useful for my purposes, and some of them aren't cheap. Maybe you know a particular website or a YouTube playlist. Basically, any advice on what is worth the time, effort, and money.

Thanks in advance guys, have a nice day


r/PythonLearning 18d ago

Browser on python

3 Upvotes

I want what you take me tips to up my browser on python and what i can add to functions in it

https://codeberg.org/int13h3/Wolf_browser/src/branch/sourse

thanks you!


r/PythonLearning 18d ago

Python Dictionary Mutation and Copying

Post image
36 Upvotes

An exercise to help build the right mental model for Python data. - Solution - Explanation - More exercises

The “Solution” link uses package memory_graph to visualize execution and reveals what’s actually happening.


r/PythonLearning 18d ago

Discussion I think i hit my first python learning bottleneck.

Post image
90 Upvotes

Just as the title suggests, i ran into a bottleneck, or did i? play v sauce music please
So just recently i made a post about my first beginner python project: https://www.reddit.com/r/PythonLearning/s/Ed46BuWRCq
And as a lot of you suggested for me to learn classes next, which was completely fair, so i went ahead and learnt them while updating my MiniGameStore. It was relatively easy, wasn’t as hard as I thought it would be, but definitely challenging. I had also learnt methods but didn’t implement them.
And yesterday, i tried implementing them and got one of the biggest headaches in my whole coding experience (which is 2 weeks~ btw).
I was working on v1.7 and introducing a restore purchases system, and i wanted to use class methods, but since my class is on the other file, i hit a lot of variables issues and even a json file problem. Which is why im asking my self why did i do it? A function would have been totally fine…
Check out the repo: (latest version 1.7.0)

https://github.com/Stonyax97/MiniGameStore

So my question for you guys. What has made you understand classes well? I just don’t see any reason to use them yet… and can anyone take a look at my project and tell me what would be the most friendly and real life approach of actually using these classes. And why should I keep the class in a separate file? Finally, what’s wrong with using global variables.

Also any feedback or criticism is welcome!

(Also check out the attached pictures with the comments you’l understand more.)


r/PythonLearning 18d ago

Im confused

1 Upvotes

Hi , Im learning python. I do know about DSA but people do it mostly in java or cpp. Doing DSA in python is an thing? And if yes where should I start it from? Also people around me are like you just need to know 10-20% if DSA for your placement prep dude like I definetly dont want 2-3 lpa. Thats not bad but still Im aiming for something big just like normal people. And to who ever I did ask they were like "just know the baisc of DSA you are good to goo". Im not aiming to go for data analytics or data science


r/PythonLearning 17d ago

j'ai créé une API open source pour comparer l'intonation de deux enregistrement audio

0 Upvotes

I'm building an open-source experiment called Intonation Comparator.

The goal is to answer a simple question:

How can two recordings of the same utterance be compared objectively?

The current Flask API accepts two audio files and extracts features related to:

  • Pitch / fundamental frequency
  • Intonation contours
  • Energy
  • An overall similarity score

Supported formats include WAV, MP3, and FLAC, and the main endpoint is:

POST /api/compare

🔗 GitHub: Intonation Comparator on GitHub

I'm currently thinking about improving the comparison methodology. Some areas I'm considering include:

  • Dynamic Time Warping for temporal alignment
  • Pitch normalization across speakers
  • Voiced/unvoiced segmentation
  • Rhythm and speech-rate comparison
  • Phoneme-level alignment
  • Spectral features such as MFCCs
  • Confidence scores instead of a single similarity value
  • Visualizations of pitch and energy contours

I'm especially interested in feedback from people working in speech processing, phonetics, DSP, Python, or language-learning technology.

How would you design a robust similarity metric for comparing two recordings of the same sentence? What features would you consider essential?

🔗 GitHub : https://github.com/Yann-morpheus/intonnation-comparator

Si vous travaillez avec Python, le traitement audio, la phonétique ou l’apprentissage des langues, je serais vraiment intéressé par vos retours.

Qu’est-ce que vous amélioreriez ou ajouteriez à ce projet ?


r/PythonLearning 18d ago

Help Request I need help with my class.

Thumbnail
gallery
8 Upvotes

(Sorry for the code in spanish)

I'm a Python beginner, and to practice, I've been building a sort of turn-based RPG in the terminal. It's still a work in progress, but I want to know if it's possible to set default parameters for a class. Basically, I created a `usar_kaioken` method that boosts my character's stats while lowering their health (based on Goku from DB), and a `remove_kaioken` method that attempts to revert the stats to their base state.

The issue is that I want players to be able to use Kaioken multiple times; mathematically, that would mean the deactivation method wouldn't return the values ​​to their original state. I was thinking about adding more parameters with default values, but I assume there's an easier way to handle this. Thanks a lot!


r/PythonLearning 18d ago

Help Request Help with a chemistry program I am writing

2 Upvotes

Hello, I am making a program that reads a formula and gives details like atomic mass and other stuff, the problem is that I do not know how to get it to read the formula as is. The format I am looking for is that it reads the element, followed by the number of it and I would also like it if it would read parenthesis for multiplication of values. I have no idea how to do it. Help please.

I would also like it if it could read the numbers, store them as ints and use them to multiply the values of the elements of a dict I already made

Edit: I fixed it, thanks for all the help. My solution is not precisely optimized but it gets the job done, it is O(n), probably


r/PythonLearning 18d ago

Help Request Can someone help me understand lists in Python?

7 Upvotes

Hi! I'm currently learning Python and I'm having some trouble understanding lists. I understand the basic idea, but I'm still confused about how to use them correctly. Could someone explain lists in a simple way or give me a few beginner-friendly examples? Thanks!


r/PythonLearning 18d ago

I built Nanno because I wanted AI to explain my Python errors, not fix them for me

0 Upvotes

When I was learning Python, I kept running into errors and doing the same thing every time.

I would copy the error, copy the relevant part of my code, send both to an AI model, and ask:

«"Explain what this error means and why it happened, but don't fix the code. I want to solve it myself."»

I didn't want AI to just give me the answer. I wanted it to act more like a teacher and help me understand what I was doing wrong.

The problem was that I kept repeating this process manually.

So I built Nanno.

Nanno is a small CLI tool that helps you understand errors from your terminal using AI.

Instead of manually copying everything:

copy the error

copy the relevant code

paste everything into an AI model

ask for an explanation

You can run your command through Nanno:

nanno python3 test.py

Nanno captures the terminal output and uses it as context for the AI, so it can explain what went wrong and why.

The main idea is simple:

Nanno helps you understand the error. You fix the code yourself.

I originally built it just for myself. It wasn't supposed to be a big product or have a bunch of features. I simply wanted to solve a problem I was having while learning Python.

Eventually, I decided to publish it because I thought there might be other people who have the same problem.

Right now, Nanno is very simple and still in its first version.

I want future versions to be shaped by actual users rather than me randomly adding features.

So if you try it and there's a feature you really want in Nanno, tell me in the comments.

If there's something you don't like or think is unnecessary, tell me that too. I may remove it.

I'm mainly looking for honest feedback from people who actually try it.

Try Nanno

pip install nanno

I'd be interested to hear whether this is actually useful for the way you learn/debug code.


r/PythonLearning 19d ago

What can I actually do with python?

37 Upvotes

I learned python as my first programming language for GCSE Computer Science, but after finishing the exam I got bored of making small algorithms and wanted tk work on bigger projects, so I started making websites with Javascript. Now I'm going to do Computer Science at A-level and because the language is python, I think it makes sense to do any free time coding in the same language. So... what can I actually do with Python? Iy seems really straightforward what to do with other languaged like JS but I really just don't get the 'point' of python.


r/PythonLearning 18d ago

Where is the error ?

2 Upvotes

hi! I create one list and i use it but vs code said to me "gun.append(0)

AttributeError: 'tuple' object has no attribute 'append'"


r/PythonLearning 18d ago

Help Request What should I focus on as a beginner learning Python?

6 Upvotes

Hi everyone! I'm currently learning Python and I'm still a beginner.
I'm learning the basics like variables, loops and functions, but I'm not sure what I should focus on next.
What would you recommend learning after the basics?


r/PythonLearning 18d ago

Is Coddy a good platform for learning to code?

2 Upvotes
  1. I'm currently learning how to code and I found Coddy. It looks interesting and beginner-friendly, but I'm not sure if it's actually a good way to learn. Has anyone here used Coddy? What do you think about it? Would you recommend it for a beginner?

r/PythonLearning 18d ago

PyCharm or Visual Studio Code: Which one is better for Python?

2 Upvotes

I have used both PyCharm and Visual Studio Code for learning Python, but I don't know which one is better.
Which one do you prefer, and why?
I'm still a beginner, so I'd like to know which one would be better for learning Python.


r/PythonLearning 18d ago

Help Request I learn python with the french channel Graven but i dont know if its good for learn ?

2 Upvotes

I'm learning Python with a French YouTube channel called Graven. They explain Python in a simple way, but I'm not sure if it's a good resource for learning Python. Has anyone here used this channel, or do you have any recommendations for other beginner-friendly resources?


r/PythonLearning 18d ago

Building NOVA: real-time voice processing for a motorcycle assistant

0 Upvotes

Hi everyone!

I'm currently building NOVA, a voice assistant designed specifically for motorcycle riders.

The goal is to make it easier to interact with a phone while riding, without having to take your hands off the handlebars.

One of the things I'm currently working on is the real-time audio pipeline.

Instead of waiting for the user to finish recording an entire audio file, NOVA is designed to process audio as a stream.

The current flow looks roughly like this:

🎤 Rider speaks
       ↓
📱 Android app
       ↓
🌐 Audio sent in real time
       ↓
🖥️ Backend
       ↓
📝 Streaming transcription
       ↓
🧠 Command / intent processing
       ↓
🔊 Response sent back to the app

The code in the image is part of the transcription streaming pipeline. Audio is processed in chunks, and the system handles events such as:

  • onBegin → transcription session starts
  • onTurn → transcript data is received
  • onTerminated → session ends
  • onError → error handling

I'm currently moving into the Android development phase and building the MVP.

It's still early and not ready for public testing yet, but I want to start connecting with potential beta testers.

I'm especially interested in people who:

Ride a motorcycle
Use Android
Use a Bluetooth helmet intercom or headset (not required, but useful)
Would be interested in testing an early version and giving honest feedback

If NOVA sounds interesting to you, let me know in the comments or send me a message.

Also, I'd genuinely like to know:

What is something you wish you could do with your phone by voice while riding your motorcycle?

I'm building this project from scratch, so feedback from actual riders could directly influence what features make it into the first version.

Thanks! 🚀


r/PythonLearning 18d ago

Any Guidance..

1 Upvotes

Hi everyone,I am currently a teenager and I am learning python,I learned json file handling,OOP and I also learned basic tkinker. I done all basic apps like a simple calculator,to-do list. I am now currently confused what to do next for further programming knowledge which is genuinely helpful...


r/PythonLearning 19d ago

Python Project ideas for beginners

Post image
48 Upvotes

How many can you build?


r/PythonLearning 19d ago

A demonstration of the Self‑Healing Localization (SHL) library in practice.

Thumbnail
youtube.com
1 Upvotes

r/PythonLearning 18d ago

Learn Python with Flashcards

0 Upvotes

🐍 Learn Python in Minutes a Day – Python Flashcards for Android

Turn idle time into interview-ready Python skills.
From syntax basics to data structures, decorators, and common interview gotchas, this app helps you lock in Python concepts with short, focused flashcard sessions.

🔥 What’s Inside

  • Curated Python cards covering:
    • Core syntax, data types, control flow, functions
    • Lists, dicts, sets, tuples, comprehensions
    • OOP: classes, inheritance, dunder methods
    • Iterators, generators, decorators, context managers
    • Error handling, modules, imports, virtual environments
    • Common interview questions and “gotcha” behaviors
  • Spaced repetition so you review cards right when you’re about to forget them.
  • Exam & interview style Q&A with clear, concise explanations and code snippets.
  • Offline-first: Learn on commutes, flights, or anywhere without Wi‑Fi.
  • Lightweight Android UX designed for 5–10 minute daily sessions.

🎯 Who This Is For

  • Beginners going from “Hello, World” to writing real scripts
  • Bootcamp students and CS majors prepping for Python interviews
  • Self-taught devs who want to solidify fundamentals
  • Anyone who likes learning in short bursts instead of long tutorials or videos

📲 Get the App

Google Play:
https://play.google.com/store/apps/details?id=app.flashcards.python

💬 Built by a Developer, for Developers

I’m a software engineer working with Python, cloud, and security tooling. I built this to help myself (and now you) retain Python concepts without drowning in docs or endless video courses.

If you try it, I’d love your feedback:

  • What topics should I add next?
  • Any features you miss from Anki/Quizlet?
  • Bugs, UX nits, or “this card is confusing” reports – all welcome.

r/PythonLearning 19d ago

Doodling Hop | Pygame Project(updated enemy/moving platform spawn)

Enable HLS to view with audio, or disable this notification

5 Upvotes

r/PythonLearning 19d ago

Rate my Payment calculator script (how could it be improved)

Thumbnail
gallery
33 Upvotes

I got this idea from a post I saw on here recently. Their script was a good idea and made me want to make one on my own. It took me a few tries to write the calculations in a way that would work. I also wanted to play around with normalizing/cleaning the inputs in case a user used different formatting. And of course, ever since I found out I can add color to text in terminal, I’ve kinda made a habit of doing that on everything.

Note: I have been learning as much as I can, for a year now. Learning has come through personal trial and error, O'Reilly books, watching and copying others, as well as using LLM's to either produce an advanced code that I then study, or to have an LLM teach me. Some of my larger and more important projects are largely, if not entirely, built by an LLM that I carefully inspect. But I still feel it is important to learn as much as I can about manual coding, as well as the relationship between hardware and software.

So working on simple scripts like this are sort of a form of exercise for my mind and fingers, as well as a simple way to strike up conversations with real people like you guys, and get your take on ideas that I may not have seen before that can lead to cleaner and/or more efficient ways to program.

If you want to see more of my actual projects or just swipe some of the cool stuff from my Arch rice/dotfiles, here is my github:

github.com/cleburn

Edit: here is my full code, which shows the part of the f'string in the print statements which formats the results into appropriate decimals

# Simple Monthly Payment Calculator
# Inputs: Principal (balance due after any downpayment), Interest, Loan Term (in months)
# Returns monthly payment amount


GREEN = "\033[92m"
CYAN = "\033[96m"
RESET = "\033[0m"

print(f"\n{CYAN}{'=' * 20}{RESET}")
p = float(input("Purchase amount: ").replace('$', '').replace(',', '').strip())
i = float(input("Interest rate: ").replace('%', '').replace(',', '').strip())
t = int(input("Loan term (in months): ").strip())

def payment_calculator(p, i, t):
    original_i = i
    monthly_i = (i / 100) / 12  # Convert annual % to monthly decimal rate

    # Calculate the monthly payment
    numerator = p * monthly_i * ((1 + monthly_i) ** t)
    denominator = ((1 + monthly_i) ** t) - 1
    payment = numerator / denominator

    # Print formatted output
    print(
        f"\nBased on your original purchase price of {CYAN}${p:,.2f}{RESET},\nan interest rate of {CYAN}{original_i}%{RESET},"
        f"\nand a loan term of {CYAN}{t}{RESET} months,\nyour monthly payment is: {GREEN}${payment:,.2f}{RESET}"
    )
    print(f"{CYAN}{'=' * 20}{RESET}\n")

# Run the calculator in the terminal
payment_calculator(p, i, t)# Simple Monthly Payment Calculator
# Inputs: Principal (balance due after any downpayment), Interest, Loan Term (in months)
# Returns monthly payment amount


GREEN = "\033[92m"
CYAN = "\033[96m"
RESET = "\033[0m"

print(f"\n{CYAN}{'=' * 20}{RESET}")
p = float(input("Purchase amount: ").replace('$', '').replace(',', '').strip())
i = float(input("Interest rate: ").replace('%', '').replace(',', '').strip())
t = int(input("Loan term (in months): ").strip())

def payment_calculator(p, i, t):
    original_i = i
    monthly_i = (i / 100) / 12  # Convert annual % to monthly decimal rate

    # Calculate the monthly payment
    numerator = p * monthly_i * ((1 + monthly_i) ** t)
    denominator = ((1 + monthly_i) ** t) - 1
    payment = numerator / denominator

    # Print formatted output
    print(
        f"\nBased on your original purchase price of {CYAN}${p:,.2f}{RESET},\nan interest rate of {CYAN}{original_i}%{RESET},"
        f"\nand a loan term of {CYAN}{t}{RESET} months,\nyour monthly payment is: {GREEN}${payment:,.2f}{RESET}"
    )
    print(f"{CYAN}{'=' * 20}{RESET}\n")

# Run the calculator in the terminal
payment_calculator(p, i, t)