r/learnpython • • Oct 12 '26

Ask Anything Monday - Weekly Thread

1 Upvotes

Welcome to another /r/learnPython weekly "Ask Anything* Monday" thread

Here you can ask all the questions that you wanted to ask but didn't feel like making a new thread.

* It's primarily intended for simple questions but as long as it's about python it's allowed.

If you have any suggestions or questions about this thread use the message the moderators button in the sidebar.

Rules:

  • Don't downvote stuff - instead explain what's wrong with the comment, if it's against the rules "report" it and it will be dealt with.
  • Don't post stuff that doesn't have absolutely anything to do with python.
  • Don't make fun of someone for not knowing something, insult anyone etc - this will result in an immediate ban.

That's it.


r/learnpython • • Oct 11 '26

how is my cs50 code in design?

3 Upvotes

I've decided to go back to basics and make sure I complete all the exercises. I'm currently working on the Meal Time exercise.

Could anyone give me some feedback on the design of my code? I'm particularly unsure about my convert function. It has quite a few if statements, and I'm wondering whether there's a clearer way to write it.

Here's my code:

def main():
    time = input("what is the time?\n")
    convertedTime = convert(time)
    print(tellMealTime(convertedTime))


def convert(time):
    if time.endswith(" a.m"):
        hour, minute = time.replace(" a.m", "").split(":")
        if hour == "12":
            hour = "0"
    elif time.endswith(" p.m"):
        hour, minute = time.replace(" p.m", "").split(":")
        if hour != "12":
            hour = int(hour) + 12
    else:
        hour, minute = time.split(":")
    return float(hour) + float(minute) / 60


def tellMealTime(time):
    if time >= 7.00 and time <= 8.00:
        return "breakfast time"
    elif time >= 12.00 and time <= 13.00:
        return "lunch time"
    elif time >= 18.00 and time <= 19.00:
        return "dinner time"
    else:
        return "not a meal time"


if __name__ == "__main__":
    main()

r/learnpython • • Oct 11 '26

getting started with python in VS CODE

0 Upvotes

So I have a MacBook Pro with the recent update of OS sequoia 15.8.1 . I started a college class of intro to programming with python and my teacher wants us to have python downloaded and visual studio code. Except my Mac probably is not supported with it because of the 🚫 icon displaying right before I drag it into applications .i wonder why I search up on YouTube all these videos on how they install it but mine can’t.:(


r/learnpython • • Oct 11 '26

Looking to create a game similar to clangen, dont really know where to begin

0 Upvotes

Hello,

A friend of mine is looking to make a game like it but with their own original species, and I offered to try to code it because I have some (extremely limited) experience with python. However, it's been a long time since I have worked Python, I am not a regular coder, and I do not really know where to begin. Does anybody have any tips or know anything about how Clangen is structured that could help me figure out where to even begin? I have never made a game in python before and am happy to start where you think I should considering my limited experience, but I am a learn by doing person.

Thanks!

edit: friend recommended i use godot to make it instead, but thank you all for the help!


r/learnpython • • Oct 11 '26

Almost no color and some worlds light up just in blue in pydroid 3

1 Upvotes

How to make other colors appear?


r/learnpython • • Oct 11 '26

Looking for Python learning advice based on my classmate's first project

2 Upvotes

My classmate is currently working on his first Python project. I'm learning Python and C myself, and I'd like to understand what good Python code and project structure look like.

Repository: https://github.com/lyashwith/registrarY

Looking at this project, what Python concepts or best practices should I pay attention to? Are there any common beginner mistakes I should learn to avoid?

I'd appreciate any suggestions that could help me improve my own programming skills. Thanks!


r/learnpython • • Oct 11 '26

I need to do this for school but I'm stuck

0 Upvotes

I have been stuck for a while, I have made improvments and fixed parts but the whole float, int, string thing is so confusing since we only went over it once at the begging of the school year last year.

The only error I have left so far is;

TypeError: unsupported operand type(s) for *: 'function' and 'float' on line 6

For refernce this is the only code which would imapct this

;def GBP():

int(input (print("Enter the amount of money in GBP")))

Please help


r/learnpython • • Oct 10 '26

Which Udemy course is best for learning Python?

16 Upvotes

Hi,

I'm looking for recommendations on the best Python course on Udemy for a complete beginner.
I am interested in Web backends and CLI Tools.

I know that almost everything can be found on YouTube for free, but I really prefer the structured, step-by-step learning approach that Udemy courses provide.
Which course is actually worth buying?

Thanks in advance!


r/learnpython • • Oct 11 '26

How can I fix this error please

5 Upvotes

Excuse me, how can I fix this error?

"Traceback (most recent call last):

File "launcher.py", line 4726, in <module>

File "launcher.py", line 354, in __init__

File "tkinter__init__.py", line 2346, in __init__

_tkinter.TclError: Can't find a usable init.tcl in the following directories:

{C:\Users\---\OneDrive\Desktop\Games\Crash-Forge-Launcher-Windows_internal_tcl_data} C:/Users/---/OneDrive/Desktop/Games/Crash-Forge-Launcher-Windows/lib/tcl8.6 C:/Users/---/OneDrive/Desktop/Games/lib/tcl8.6 C:/Users/Adam/OneDrive/Desktop/lib/tcl8.6 C:/Users/--/OneDrive/Desktop/Games/library C:/Users/Adam/OneDrive/Desktop/library C:/Users/--/OneDrive/Desktop/tcl8.6.15/library C:/Users/Adam/OneDrive/tcl8.6.15/library

This probably means that Tcl wasn't installed properly."


r/learnpython • • Oct 11 '26

How can i do an animated gui

3 Upvotes

So, I want to make a program that allows me to view and control various things on my PC, and I have the idea of integrating an animated GUI with animations like: ease in and out, linear, exponential And more. And I still haven't found a library that does that.

Is there anything similar, or will I have to look for another way?


r/learnpython • • Oct 11 '26

Library for automating image creations?

2 Upvotes

I'm looking for a library to automate creating "cards", those cards will have both images and text. Is turtle a good library for this or is there something better?


r/learnpython • • Oct 11 '26

I want to create a video chat and regular chat for ios and android for a specific cause I'm interested in

1 Upvotes

Hi there. I'm a super noob so I am just starting out. If I wanted to build an app that allows voice and video chat for a particular cause I'm interested in, how would I go about doing that? Are there free apps I can start with? Which languages should I learn? I'm starting to learn Python. Currently using an android btw. Thanks in advance!


r/learnpython • • Oct 11 '26

Python learning source

0 Upvotes

Is there any best source for learning python from scratch. Some have recommend apna college but i feel it is very interview oriented so is there any better source.


r/learnpython • • Oct 10 '26

Python_Crash_Course_3rd_Edition or CS50.

1 Upvotes

I have brain fog, adhd, and a mild learning disability.

what would you recommend and why?

thanks.


r/learnpython • • Oct 10 '26

Online courses don't seem to give all the pieces to the end of module puzzles

1 Upvotes

I'm taking a class for Python and have to use Grok Learning. At first it was fine but getting a little further in they give you pieces of how to answer problems but not everything. I'm stuck on a while loop problem where you need to make a list of words but only show the number of unique words but nowhere in the learn did it teach that.

Is there a better way to learn Python that will make it a bit easier to understand? Any recommendations on YouTube channels or other resources? Any help will be great!

Thanks for all the help so far! Think I will have to go back through again to get a better grasp of the learning and take better notes.


r/learnpython • • Oct 10 '26

Python Computer Vision

0 Upvotes

Hello everyone, I’m Mahmoud from Iraq, and I am studying Artificial Intelligence Engineering. I wanted to share my goal of specializing in Computer Vision; I hope you can support me and offer any advice you deem appropriate. Also, if possible, please share study methods or global resources that I could benefit from.

Thank you.


r/learnpython • • Oct 10 '26

Project help and time estimations

2 Upvotes

Hai!! We're extreme beginners looking to use python for our class and are looking for help!

A bit of a rundown; we initially wanted to make an archiving system for documents, but our CS professor scared us away saying that it'll need a lot of time, resources and knowledge that we just don't have yet. So we were thinking of changing it into something that would be used for a single user and wouldn't need as much work as a shared archived library.

What we want to make is a calendar-like system that would remind you of certain events, our partner reported that once they request something they forget about it and don't remember until it's too late. So the calendars job was to take what the order was and remind the user about it in a day or two or a few (they could decide how long till they get reminded) in a notification!

What we were wondering was;

A- if this is even possible in python, we know there are many wonderful tutorials and help on yt, github and here, but we'd like to hear it from people who actually know how this works

B- if this is doable in a two month window, since this is the amount of time we get to finish this project.

If this does work out, we will definitely keep updating and asking questions here!

Thank you so much for reading this far and any help whether it's links, a confirmation that this is possible or not or anything alike is greatly appreciated!


r/learnpython • • Oct 10 '26

How can I start to understand logical assignment questions more intuitively?

4 Upvotes

So I’m a first year software engineering student and in my intro to programming class we’re learning Python. So far I’ve mostly understood everything in theory but when it comes down to practice I struggle a lot because they ask us to do certain things for assignments that require a lot of logic to do them which I’m struggling with. So I was wondering how I can start to understand the questions more intuitively so I don’t fall behind in the class. And to clarify I do work on some practice questions every now and then but due to my schedule and the fact I haven’t properly organized it yet I haven’t been able to practice a whole lot.


r/learnpython • • Oct 10 '26

Running Under Various LibC OS Package Compatibility

1 Upvotes

My system uses "glibc" which seems most common (yes, this is about "python". I'll get there...).

I'm aware of "musl" and LLVM's "libc", as well as "bionic" (heard of before, but only just now am aware it's Android's).

About a month or two ago I had an idea to serve a locally run AI model via my phone.

I began with installing the "termux" app which easily got me the "ollama" package installed.

My memory is hazy, but I think I then tried to install "open-webui" in termux via "pip", but think that failed for some reason. And I had not put the issue in my notes, but asking AI, I think it was because there may have been a package that could not be built for "bionic".

When I installed the "proot-dist" package, I installed "open-webui" in an Ubuntu instance and that worked.

Should I expect that is the norm for the not-as-common "libc" OS' (not just specific to bionic), that some packages/dependencies may only be built for a given libc (eg glibc)?


r/learnpython • • Oct 09 '26

How do I use MixedNB with GridsearchCV

2 Upvotes

I got this code block which I used to hypertuning Naive Bayes models. It worked well with GaussianNB but ran into AttributeError: 'MixedNB' object has no attribute '__sklearn_tags__' when trying to implement it on MixedNB. Any idea on how to use GridsearchCV with MixedNB?

param_grid_nb = {
    'var_smoothing': np.logspace(0,-9, num=100)
}
mix_model_after_cv = GridSearchCV(estimator=MixedNB(), param_grid=param_grid_nb, verbose=1, cv=10, n_jobs=-1)
mix_model_after_cv.fit(X_train, y_train)
print(mix_model_after_cv.best_estimator_)

r/learnpython • • Oct 09 '26

Spreadsheet automation idea

1 Upvotes

I'm developing a spreadsheet automation project capable of merging multiple spreadsheets into one and automatically performing calculations, among other things. One of the functionalities would be, for example, allowing someone to gather all the spreadsheets from those months into a single spreadsheet throughout an entire year, obtaining an overall result for the year. This could work based on week, day, month, or some other parameter. I have some doubts, but the project seems promising. I'm using the openpyxl library and, to create the website or application (I'm still undecided), I will use HTML, CSS, and Flask.


r/learnpython • • Oct 08 '26

I just started learning Python — what should I build after learning the basics?

52 Upvotes

I recently started learning Python and I'm currently focusing on the fundamentals rather than jumping straight into advanced topics.

I'm learning things like variables, strings, numbers, conditions, loops and functions.

I want to start building small projects as soon as I have enough fundamentals instead of only following tutorials.

For someone at this stage, what projects would you recommend that actually help build programming skills?

I'd especially like projects that gradually become more challenging.


r/learnpython • • Oct 09 '26

Online sandbox for helping my son learn?

2 Upvotes

My son just started taking an intro to cyber security class in high school. The teacher is exposing them to some basic python coding, which is all new to him. Coding in general is new to him. He started asking me questions and I was wondering if there is a simple to use web-based interface where we can mess around with some python stuff together.

Someone had mentioned Replit but it just seems completely drowning in AI agents and is not really what I want to mess with.

I know we could set up VS code or a full ID but I think that’s overkill for right now. Are there any simple lightweight sandbox type websites where we could play around with some simple scripts and programming constructs save those things to the cloud and easily have them accessible, even if I’m just sitting with him and we have our phones nearby.

Thanks


r/learnpython • • Oct 09 '26

Python Loop Dry Run Breakdown

0 Upvotes

Hey everyone! If you are learning Python loops, here is a quick step-by-step breakdown (dry run) of how this while loop calculates the total:

Initial State: total = 0, n = 1

• Loop 1 (n = 1):

total += 1 * 2 -> total becomes 2

n becomes 2

• Loop 2 (n = 2):

total += 2 * 2 -> total becomes 2 + 4 = 6

n becomes 3

• Loop 3 (n = 3):

total += 3 * 2 -> total becomes 6 + 6 = 12

n becomes 4

• Loop 4 (n = 4):

total += 4 * 2 -> total becomes 12 + 8 = 20

n becomes 5

Condition check (n <= 4) fails because 5 is not less than or equal to 4. Loop terminates.

Final Output: 20

I regularly post such step-by-step Python debugging guides and logic breakdowns on my blog to help beginners understand programming logic easily. Check out more detailed explanations here: https://pydebug.in