r/learnpython • • 6d ago

Ask Anything Monday - Weekly Thread

7 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 • • 9h ago

Efficiency practice for daily python training

9 Upvotes

My goal is to become fluent with Python programming in every shape and form it has to offer. I am nearing the end of my intro to Python class and also use Coddytech.com the end goal is AI automation.

I’d like to know how to truly practice and build programs daily so that I am more hands on and can start laying a true foundation for myself instead of just learning the fundamentals and still using ai to help me write code.

What’s some advice an expert can give me and others in my situation?


r/learnpython • • 9h ago

strings in if statements

9 Upvotes

While debugging my code I discovered [what to me looked liked] a weird quirk in the language (see code below.)

Why does this work? why is a single string callable in the Boolean of an if statement? does a string always return evaluateTrue when used like this?

(edit: solved. corrected some of my vocabulary so now yous can stop "um, actually"-ing me. Thanks to everyone who helped!)

if "something":
  print("another thing")

>>>"another thing"

r/learnpython • • 11h ago

Learning code and programming

8 Upvotes

Im on a gap year and totally new to coding im based in the UK so i have not done any comp sci GCSE or A-Level and im struggling to learn. I tried the Harvard lectures but I couldn't understand what he was saying and the input he would put in wouldn't make sense to me. Im bored in my gap year and want to pick up a new skill any help or advice would be appreciated.


r/learnpython • • 6h ago

Need feedback

2 Upvotes

I made my first big python project as a beginner high school student. It visualizes CO2 emission trends and compares with countries and compares gdp, population and other stuff. It uses matplotlib, numpy, seaborn, streamlit and pandas.
link: https://github.com/rapanjeetsingh/python-project


r/learnpython • • 9h ago

I struggle with math and abstract thinking. Is DSA realistic for me, and is data engineering a viable path?

3 Upvotes

Hi everyone,

I'm a beginner in Python and I'd really appreciate some honest advice from people with more experience.

My background

  • Python level: I know the basics (variables, loops, functions, lists and dictionaries), but I'm still learning how to write programs on my own.
  • Time I can study: About 1 to 2 hours a day.
  • Goal: Get a job in tech, possibly as a data engineer.
  • Math: I've always been weak at it, and I often feel I'm not great at logical or abstract thinking.

My concern
I'll be honest: I'm not good at math, and my logical thinking is weak. In school I struggled with math, and I often get stuck when a problem requires me to break it down step by step. Whenever I read about data structures and algorithms, I worry that these weaknesses will hold me back. I don't want to spend months studying only to find out I was on the wrong path. At the same time, I'm willing to put in consistent effort if there's a realistic way forward.

My questions

  1. Is DSA realistic for someone who is weak at math? Is it mostly about practice and pattern recognition rather than natural talent?
  2. How much DSA does a data engineer actually need in real work and in job interviews? Are the basics (lists, dicts, sets, stacks, queues) enough, or do I need trees, graphs and dynamic programming too?
  3. What is a sensible learning order? I was thinking: arrays/strings → hash maps → stacks/queues → linked lists → trees → graphs. Does that make sense?
  4. Which resources worked for you? I've looked at VisuAlgo, NeetCode, CS50 and Grokking Algorithms, but I'm not sure how to combine them.
  5. Should I learn SQL alongside Python from the start, given that I'm interested in data engineering?

What I've tried so far
I've followed some beginner Python tutorials and practiced small exercises, but I often get stuck when I have to solve a problem on my own, and that makes me doubt myself. I haven't started DSA yet because I'm not sure where to begin.

If you were in my position, what would you focus on first? Any advice, roadmap, or personal experience (especially from people who also struggled with math) would mean a lot.

Thank you for reading!


r/learnpython • • 7h ago

2D graphics around turtle

2 Upvotes

I created a module called "graphics_2d". Here is the repository: https://github.com/Crusher-Titanium/graphics_2d


r/learnpython • • 4h ago

Biology student and PCEP & PCAP

1 Upvotes

Hi, everyone!

I’m a biology student (bachelor’s degree) in Italy. I’m F30 years old and still have several exams left before I graduate.

In the meantime, I’ve purchased the PCEP and PCAP courses to earn those two certifications later on (I had to spend some virtual money and there wasn’t anything interesting, so I thought of Python, since it can’t hurt, in my opinion).

As you can see, I have absolutely nothing to put on my resume, not even for jobs in biology labs that don't require a degree (there are few, but they do exist; however, I've never been hired for one). I've never worked before and only have experience in university labs, which has been very limited, just a couple of days a year for a course.

I was wondering: does it make sense, in my case, to keep studying Python to get those two certifications, or not? Is it worth studying Python in general to “retrain” myself? It would definitely be better to have a GitHub page and lots of projects, but I don’t think I’m capable of reaching that level in programming.

In any case, I plan to finish my bachelor’s degree. After that, I don’t know what to do.


r/learnpython • • 5h ago

Need Help In Coding

0 Upvotes

Hello Redditors ;) 

I am very new to programming and don't have a lot of time right now. I know Python fundamentals, so I can do simple coding, sometimes not even simpler ones, and I can't solve even medium-level problems at all. I have no idea how to get better, it's just so damn hard. When you look at a question, how do you know which logic or tools to use? I'm getting really tired and frustrated because it feels way too difficult. How should I actually get good at this? Please help me out how do you guys actually write code? 


r/learnpython • • 8h ago

After a while of learning programming

2 Upvotes

So I am stuck in tutorial hell for a long while and I had to realize that I have no idea what a program’s code looks like so I can’t compare myself from it and can’t learn from it. And tutorials don’t give practice lessons for some reason.


r/learnpython • • 12h ago

What is the point of getcanvas()? And the method get()

2 Upvotes

Hi, I'm currently on an assignment that requires me to use this function, but not only have we never seen it in class but all the research I've done haven't help me at all. My teacher also mentions the method get() in the instruction and I'm also confused by it.

Edit More details

Long story short, my assignement is to create a "forest". For that I created functions to draw the trees but I still have to create a window and a button that allows the user to choose how many trees will be drawn in it. It's at that point that I have to use the "getcanvas()" to supposedly make a window and the "get()" in a function that will be used as a command in the button.

from random import*#Used in functions
from turtle import*
from tkinter import*
from math import* #Used in functions

master= getcanvas().master #Exact line my teacher wants us to use 

screen = Screen()
screen.setup(800,500)
colormode(255)
screen.bgcolor(0, 46, 122)
speed(2000)
#What I'd like to do with it

def nbreSapin(): #Function in which I have to use 'get()' to get the number of trees
    nb= int(input("How many trees:"))
    if nb<100 and nb>0:
        getsapin(nb)
    else:
        pass

r/learnpython • • 5h ago

FCC Python cert seems outdated (v7 archived). Should I start with the current v9 curriculum or look for alternatives?

0 Upvotes

I have reviewed numerous assessments regarding the FCC Python Certifications, which generally indicate that the video lectures are of poor quality. Furthermore, the "Scientific Computing with Python Certification" currently displays a notice stating: "The content in this section is not being updated, but is still available for you to further your learning. We recommend trying our current curriculum." The current curriculum includes the Python certification located at https://www.freecodecamp.org/learn/python-v9/

As I require a certificate for a specific purpose, I am evaluating this resource. I would also appreciate recommendations for alternative certifications, as I intend to complete the "Data Analysis with Python" and "Machine Learning with Python Certification" courses subsequently.

Could you please review this information and advise whether it is advisable to begin my Python studies with this resource? Additionally, I would value suggestions for reputable instructors or YouTube channels that teach Python programming effectively. I am a fast-paced learner who requires only minimal guidance from a mentor or teacher at the beginning and intermittently, as I am confident in my ability to learn independently thereafter. I would appreciate your response.


r/learnpython • • 13h ago

B.Pharm student looking for help with a CNN-based project in Pharmacognosy!

2 Upvotes

Hi everyone!

I'm a final-year B.Pharm student working on my final-year project under Pharmacognosy, and I've decided to explore using Convolutional Neural Networks (CNNs) to detect adulterants in powdered crude drugs through microscopic images.

The idea is to train an image classification model that can distinguish genuine crude drugs from adulterated samples, potentially making herbal drug quality control more efficient.

Here's the catch: I'm a complete beginner when it comes to coding and machine learning!

I've tried a small experiment on Google Colab (black pepper vs. papaya seeds), but I have a LOT to learn.

I'm looking for help from:

  • IT/CS students or professionals familiar with Python, CNNs and image classification.
  • Anyone experienced with machine learning, microscopy or image datasets.
  • Pharmacy/Pharmacognosy researchers who could offer guidance on the scientific side.

I'm willing to put in the work and learn. I'm not expecting anyone to do the project for me; even a little guidance, useful resources, research papers or suggestions would mean a lot.

I have around 7 months to work on this, and I'd love to connect with anyone who might be interested in helping me navigate this journey.

Any help is genuinely appreciated. Thank you! :)


r/learnpython • • 12h ago

What's the best way to learn well in projects part of python crash course by Eric Matthes?

0 Upvotes

hello everyone, so I start learning python and I get python crash course book by Eric Matthes

and everything went well, I reach the projects part and I am not sure what's the best way to learn from it, should I read the chapter then try to write my own code, or is there more efficent way to actually learn, I am kinda concered I might just copy and paste the code without actually learn anything, thanks in advance


r/learnpython • • 13h ago

Complete Python Roadmap for AI/ML, LLMs, NLP, RL and Robotics

1 Upvotes

Hi everyone,

I want to master Python and build a strong programming foundation for a career in AI/ML, LLMs, NLP, Reinforcement Learning, Computer Vision and Robotics.

I'd like advice on:

  1. Which Python concepts should I master from beginner to advanced?
  2. How deeply should I learn OOP, DSA, decorators, generators, multithreading and asynchronous programming?
  3. Which libraries should I prioritize: NumPy, Pandas, SciPy, Scikit-learn, PyTorch, TensorFlow and Hugging Face?
  4. What Python skills are essential for implementing ML/DL algorithms and research papers?
  5. How much Python is required for LLM development, fine-tuning and Reinforcement Learning?
  6. Which projects should I build to develop strong practical and research-oriented skills?

I'd appreciate a structured learning roadmap and recommendations for high-quality resources.

Thanks in advance!


r/learnpython • • 6h ago

is This possible?

0 Upvotes

so, as of recent ive come to know that docs uses hella ai, and like scraps your stuff even when they say they dont, so i wanted to know if its possible to make a google docs like app (for pc) using python, im sure its possible but i dont know where to start, i will need to learn the logic and how to code first but im not sure if theres any useful tutorials

i just want to make my own documents app so i can write whatever i want with normal storage to my pc and write books.


r/learnpython • • 5h ago

Advance python in 5 days

0 Upvotes

Guysss .. need serious help

I have a very supreme competitive robotics comp... Our robot needs to solve a maze n more. I need to program it in python. Otherwise v r cooked.

I know basics of python- lops, variables, strings, conditions, ranges, operators, input, functions etc. But not the level to program the bot

Im programming a lego spike prime. Plss suggestions needed.

( My siblings are 10/10 in robotics so i hv a huge comparison, can't take help from them)


r/learnpython • • 1d ago

Anyone help me with this loop? I cant break out of the outer loop?

3 Upvotes
while True:
    try:
        STickets = float(input("Please enter the amount of student tickets you would like"))
        if STickets %1 !=0:
            print("please enter a whole number!")
            continue
        elif STickets < 0:
            print("please enter a positive number!")
            continue
        else:
            print(f"You have selected {int(STickets)}")
            Answer = input("is this the correct number? Yes/No").strip().capitalize()
            while True:
                    if Answer == "No":
                        break
                    if Answer =="Yes":
                        print("Confirmed")
                        break
                    else:
                        Answer = input("Enter Yes or No: ").strip().capitalize()
                    if Answer == "Yes":
                    break

r/learnpython • • 1d ago

Variability in langdetect output

3 Upvotes

Hi all,
I’m using Python to filter out rows that contains non-English text from a noisy 10,000-row Excel dataset, and the final count varies slightly between runs (for example, keeping 7,522 vs. 7,508 cells—a difference of less than 0.001% of total cells). Is that normal for noisy data, and is that level of variance acceptable for research?

Thanks all!


r/learnpython • • 1d ago

Roadmap and book recommendations for advanced Python, Data Structures, and AI?

5 Upvotes

Hi everyone,

I am looking to build a strong foundation in Python with the long-term goal of getting into Machine Learning and AI.

Right now, I want to focus on three main areas:

  1. Advanced Python concepts (writing clean, efficient, and Pythonic code)
  2. Data Structures and Algorithms (DSA) in Python
  3. Transitioning from core Python to AI/ML libraries

Could you recommend a good learning roadmap, along with the best books or free resources to start with?

Thanks in advance for your help!


r/learnpython • • 1d ago

Function without argument

1 Upvotes

Ive got a function that takes a dictionary as an argument.
Now Id like to program it so when the function is called without any argument, instead of an error message it prints something custom (a dictionary for example).

Any help is appreciated :D


r/learnpython • • 1d ago

CS50 problom 4 Gussing game

0 Upvotes

this is what im trying to do https://cs50.harvard.edu/python/psets/4/game/

this my code

import random


while True:
    try:
        level = int(input("Level:"))
        if level >= 0:
            False
        number = random.randint(1, level)
        output = number
        if output < number:
            print("Too small!")
        elif output > number:
            print("Too large!")
        elif output == number:
            print("Just right!")
        
        print("Guess:", number)
    except ValueError:
        pass

when I start and give a number it give ether it stopes it "Just right!" or print both "Just right!" and Guess: so how do I make it don't do that and do what it suppose to do in the problem


r/learnpython • • 1d ago

Editable module not found error

3 Upvotes

I have a custom module that I am developing and I can not get it to import when installing with

"uv pip install -e ."

directory structure:

niceachemy/
|-src/
|  |-nicealchemy/
|  |  |-__init__.py
|  |  |-fields.py
|-pyproject.toml
|-setup.py

pyproject.toml:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "nicealchemy"
version = "0.1"

setup.py:

from setuptools import setup, find_packages

setup(name='nice-alchemy',
      version='0.1',
      author='Nathan Shaffer',
      author_email='nathanjshaffer@gmail.com',
      license='MIT',
      packages=find_packages(where='src'),
      package_dir={
          'nicealchemy': 'src/nicealchemy',
      },
      zip_safe=False)

script is running on a nicegui docker image that uses uv by default.

When I install my module from github, it works just fine, but if I try to install from a volume as editable, import fails with

ModuleNotFoundError: No module named 'nicealchemy'

I have tried specifying the .venv location to pip install and editable compatibility mode

uv pip install --python /opt/venv/bin/python -e . --config-setting editable_mode=compat

I have listed the installed modules from within the script and it correctly lists my module:

from importlib.metadata import distributions

installed = sorted(
    f"{dist.metadata['Name']}=={dist.version}" 
    for dist in distributions()
)

for pkg in installed:
    print(pkg)

/opt/venv/lib64/python3.14 shows a dist-info directory for the module.

I have rebuilt the docker stack many times to make sure the pip install is not being shadowed by the git module installation.

I just can not figure out what I else could possibly check for at this point

EDIT: So what I ended up doing, as nothing I tried doing would work, is I just made a simling in /opt/venv/lib64/python3.14/site-packages to the module src directory, and that worked. I know its not the correct way, but honestly, not sure why the editable install doesn't just do that.


r/learnpython • • 1d ago

Intermediate in Python — How do I move beyond the basics and master Python for real-world software?

1 Upvotes

Hey everyone,

I’m a Computer Science undergrad currently at an intermediate level in Python. So far, I’m comfortable with core syntax, data structures (lists, dicts, sets), basic problem-solving, OOP concepts, and exception handling.

Right now, I feel stuck in the phase where I know how to write basic scripts and solve logic problems, but I don't know how to take the next big step toward mastering the language and building real-world applications.

For those of you experienced with Python:

What intermediate-to-advanced Python concepts (like decorators, generators, file/API handling, or memory management) should I focus on next?

What kind of practical projects helped you bridge the gap from writing simple scripts to building actual software?

Any recommended books or resources for writing clean, Pythonic code?

Thanks in advance for any guidance!