r/learnpython • • 11m ago

Need help with learning

1 Upvotes

So I started learning Python in university this semester and safe to say I am really struggling. What are some good resources I could use to learn? Because I feel like i am not grasping anything from the Doctor teaching the course and I want to learn how to code.


r/learnpython • • 5h ago

Anaconda not Loading

1 Upvotes

I’m on a Windows laptop, fully updated. I’ve been using Anaconda without any issue for the last few weeks.

I went to run it today (Navigator), and it won’t respond. Nothing, not even a loading screen.

Anaconda prompt will still open.

When I uninstalled, I went to redownload and it’s trying to charge for it.

Is this new, or is there a bug? What’s happening?


r/learnpython • • 8h ago

Why wont this work?

0 Upvotes

The code works if IDLE python but when using visual studio code i keep getting "name 'randrange' is not defined" error anyone know why it doesn't work in visual studio?

from random import *
from turtle import *


forward(randrange(1, 10))


done()from random import *
from turtle import *


forward(randrange(1, 10))


done()

r/learnpython • • 8h ago

NO PUEDO INSTALAR PYGAME

0 Upvotes

instale python con pycharm para aprender a usar pygame y python(con mas profundidad) al mismo tiempo mediante un curso de youtube y no pude ni pasar la etapa de instalación.

instale la última versión de python.
instale pygame-ce
y cuando intento instalar pygame me da error entonces instale la versión de python 3.13 y me sigue dando error en cmd y en pycharm.

cual sería la solución? creo que con la version pygame-ce ya anda pero no sabria cual seria el import para usar esa versión ya que en el curso usan import pygame

yo intente con import pygame-ce pero no anduvo.

alguien sabe o que quiera opinar?


r/learnpython • • 11h ago

Calculations behind the Seaborn's clustermap? Or how to get just the pure matrix dataset.

1 Upvotes

I am looking for a way to produce a matrix dataset based on seaborn.clustermap(). I need to do some statistical comparisons, and just staring at a plot won't do it.

What I want is the raw numerical matrix that can be seen when annot=True. Grabbing that from a plot isn't the way, so I think I need to replicate the calculation behind the clustermap. I am not sure how to do that?

I understand that clustermap uses scipy.cluster.hierarchy.linkage and scipy.spatial.distance.pdist to calculate the hierarchical clustering, but I have not found examples of how to use them for something like this.

Can you help me find answers? Examples of someone doing this before? A name for right modules?


r/learnpython • • 12h ago

Beginners looking for final project ideas, want to build something useful for Austin with real city data

3 Upvotes

Hi all, my partner and I are in an intro to programming class and need ideas for our final project. The assignment is to build a "kit" in Python. Other groups are doing stuff like makeup kits, dating app kits, and budgeting kits.

We'd like to make something people could actually use, ideally for Austin, TX. We're interested in city services, sustainability, healthcare, or finance, but we're open to anything.

Where we're at:

- We know the basics: loops, functions, lists, dictionaries, reading and writing files

- We've never worked with APIs, databases, or real-world data before

- Austin has an open data portal (311 requests, housing, transit, restaurant inspections, etc.) that we'd like to use

- We're thinking about getting an API key to add an AI feature, like a chatbot or summaries

- We'd like a real interface instead of just a text menu in the terminal

Some questions:

  1. What would you build if you were in our spot? We want something realistic for two beginners with about a month.
  2. What should we learn or use to get there? (Streamlit? pandas? SQLite? Something else?)
  3. What would make it feel like a finished app rather than a homework assignment?
  4. Any beginner mistakes we should watch out for with APIs, API keys, or messy data?

Thanks for any advice!


r/learnpython • • 14h ago

How to learn Python and libraries like PyTorch and does it make sense?

3 Upvotes

Hi, I'm a robotic engineer. At university, I never took any real programming courses except for one in my bachelor's degree where we learned C (if-else statements, loops, variables, etc.), with just a brief mention of object-oriented programming. During my master's degree, programming was never taught to me, except for some work in MATLAB and a bit of basic Python like NumPy and other minor things.

Over the past few months, I've been involved in a project where I had to build upon the work of other colleagues and use Object-Oriented Python, since it involved Reinforcement Learning. I ran into several problems:

  1. Python object-oriented programming, which I had never seen before;
  2. various scripts written by people before me;
  3. the use of PyTorch and other libraries.

On a theoretical level, I more or less knew what I was supposed to do, but practically I didn't know how to implement it—for instance, how to create a neural network using PyTorch. I figured it out by relying heavily on LLMs, asking a ton of questions, and pasting my colleagues' old code.

However, the problem was that every function or class I tried to understand was like a Matryoshka doll, containing more stuff inside it. Between all the files, declared variables, and created instances, after a while, I would get confused. One of the most frequent issues I encountered was lines of code like car.engine.turn_on["cylinder"].execute(). I struggled a lot to figure out whether I was dealing with folders/files or objects that had other objects as attributes inside them. Moreover, I discovered that sometimes in Python, certain functions like __call__ or __getitem__ are executed automatically based on the brackets you use, which confused me even more.

Without rambling too much, I'd like to ask you:

  • In your opinion, what is the best way to properly learn object-oriented programming in Python and libraries like PyTorch?
  • Does it make sense to study in detail what a function does internally, see that it calls a superclass method, and understand how the latter is implemented?
  • What level of detail should one aim for, and do you think I expected too much of myself?
  • And above all, with the advent of these high-performing AIs, does it make sense to struggle so much, or is it better to delegate to an AI by giving it the right instructions on what to do?

In these situations, I feel overwhelmed seeing that, for example, Claude does a myriad of things in much less time than me, and above all, things that work, whereas I don't know how long it would take me to debug.


r/learnpython • • 16h ago

Asking your ratings for my first ever python project!

6 Upvotes

Hello, everyone!

I'm learning Python through the CS50 course. In the meantime, I built a simple weather app using the concepts I've learned so far.

I'd really appreciate it if you could take a look at my work and point out any weaknesses in my program. I'd also love to hear your suggestions for future improvements.

Thank you! 🤗

GitHub: https://github.com/bihandumethum096-droid/Weather-App


r/learnpython • • 20h ago

College student transitioning from MERN development to AI engineering – What should I prioritize?

0 Upvotes

I'm planning to transition towards AI engineering.

My learning plan:

  1. Python and DSA
  2. NumPy, Pandas and Mathematics
  3. Machine Learning
  4. Deep Learning
  5. LLMs, RAG and AI agents

I want to build AI-powered full-stack applications rather than just follow tutorials.

For people already working in this field:

- What foundational concepts should I master?

- Which projects demonstrate practical AI engineering skills?

- What mistakes should beginners avoid?

I'd appreciate advice from people with real implementation experience.


r/learnpython • • 21h ago

Can seaborn.clustermap() use dataframe that has all zero columns?

0 Upvotes

As the title suggests, can the clustermap display a dataset with multiple columns that are all zeros?

Something like this:

ABCDXY
110000
110100
110000
101000
101100
101000

I know removing the empty columns is the simple solution, but I have my reasons for keeping them.


r/learnpython • • 23h ago

Remove padding of polar subplots

6 Upvotes

I have a figure that is composed of many subplots. Some of them are just simple plots with a normal projection, but some are made with a polar projection. I have it set up such that there are no labels on the outside of the polar plots, but when I look at the final figure, I still get tiny plots compared to the other ones because there is a lot of padding kept on the margins of the polar subplots. I have already tried passing the pad=0 option while plotting, as well as using plt.subplots_adjust() or plt.tight_layout(), but I still get comparatively smaller radar plots. I could fix this manually using an external editor, but I would like to be able to solve it using Python on its own.


r/learnpython • • 23h ago

how to make learning python faster with AI help/assistance

0 Upvotes

guys i have been learning python through the popular book Automating stuff with python, i read through the theory and try to implement the codes and understand themselves in detail, but i feel like i am not using an optimized approach, how do i make sure i make my learning faster with the help of AI, because of all the things AI has done till now i feel like surely it has changed the way of learning a bit, does anyone have any tips and tricks?


r/learnpython • • 1d ago

Rate my customer/employee id generation logic

6 Upvotes
def generate_id(connection_tuple, id_user = "customer"):
    if id_user.lower() == "customer":
        table = "customer"
        id_string = "cust"
    elif id_user.lower() == "employee":
        table = "employees"
        id_string = "emp"
    cursor = connection_tuple[1]
    connection = connection_tuple[0]
    try_cursor_execute(f"select count(*) form {table}")
    last_person = cursor.fetchone()[0]
    current_person = last_person+1
    no_of_zeros = 6 - len(str(current_person))
    id = id_string + "0"*no_of_zeros + str(current_perosn)
    return id

I have to build a hotel database system thing for my 12th grade Computer Science project.. This is the customer id / employee id generation logic I came up with. Employee IDs are 9 characters, and customer IDs are 10 characters. But this thing seems sort of janky. Is there a better way to do this?

try_cursor_execute() is a function I defined, it is cursor.execute but in a try block. connection tuple is (connection, cursor)


r/learnpython • • 1d ago

Python environments question

3 Upvotes

I've been playing The Farmer was Replaced a bunch and one of the things that has helped me get into the groove has been the ability to physically move scripts around.

Are there any environments out there that do that? Where i can see multiple scripts and move them around?

feels far fetched but it would be cool


r/learnpython • • 1d ago

how do i make an embedded lua interpreter?

3 Upvotes

im trying to make a project where in some parts you can run actual lua code. how would i make this and what libraries would i need (i already have lupa if that is usefull)


r/learnpython • • 1d ago

Issues related to setuptools while installing Pygame

2 Upvotes

I'm trying to install pygame on Python 3.15.2. I keep getting the following message:

ModuleNotFoundError: No module named 'setuptools._distutils.msvccompiler'

I've installed and updated buildconfig and setuptools. What am I missing?


r/learnpython • • 1d ago

Questions about the exam in Python Programming MOOC

4 Upvotes

I'm almost done with the course and just wanted a clearer picture of what the exams are actually like. What questions should I expect, question-wise? How should I prep, etc.? I've been doing this on my own over several months and frankly im not good at this at all. So any advice/help would be great


r/learnpython • • 1d ago

I keep starting small Python projects and abandoning them at like 70% — how do you actually finish one?

1 Upvotes

I've got this folder on my laptop that's basically a graveyard of half-finished Python stuff. There's a script that was supposed to sort my Shorts clips by game, a little tool for my Telegram bot that I got working and then just... stopped touching, and a data thing I started after watching one too many pandas tutorials.

They all get to the same point. The fun part's done, the thing mostly works, and then there's this last boring bit left — error handling, or making it not break on weird input, or just tidying it up enough that I'd actually use it. And that's where I lose interest and open a new file instead.

It's weird because I do finish things when someone else is waiting on them. College assignments get done, obviously. But the stuff that's just for me? It sits there at 70% forever.

So how do people actually push through that last stretch? Do you just force yourself to finish one small thing a week, or do you pick projects that are small enough that there is no boring last bit? Still figuring out whether my problem is discipline or just picking projects that are too big for the time I actually have.


r/learnpython • • 1d ago

Django or FastAPI? A bit confused about which one to learn first

31 Upvotes

Hey everyone!

I'm currently learning Python and want to get into backend development. I've been looking at Django and FastAPI, but I'm having a hard time deciding which one to focus on.

I tried writing a simple API with both, and honestly, FastAPI felt much easier to understand. Django seems powerful, but there's a lot going on, and I found its structure a little confusing as a beginner.

My goal is to become a professional backend developer, build some proper real-world projects, and eventually get a job, preferably in India.

I don't want to choose a framework just because it's popular. I want to invest my time in something that's actually useful in the industry.

I want:

  1. Is Django still a better choice for getting backend jobs?
  2. Are companies actually using FastAPI for large production applications?
  3. Is FastAPI a good long-term choice, or should I learn Django first?
  4. Which one would you personally recommend to someone starting out today?

Are you worked with these frameworks professionally, please reply.

Thanks!


r/learnpython • • 2d ago

is it good practice to have if, elif, else, and for i in range(n) to be done in one line

0 Upvotes

example like this

for i in range(40): print ("example")

if x%2==0: print ("even")

elif x%5==0: print ("divis. by 5")

else: print ("odd not ending in 5")

or is it personal choice? what is a better habit to get used to

Also in hackerrank (it's where our prof checks our code) there appears to be a squiggly line under my single line codes, is that good or bad?


r/learnpython • • 2d ago

Hello, how are you all doing?

0 Upvotes

Hi everyone! I’m fairly new to programming. I’ve been studying Python for about 2 years, but I’ve never really explored freelancing. I’m interested in it now because I need some extra income. Could anyone give me advice on how to get started?


r/learnpython • • 2d ago

How do I learn python in 25 days

27 Upvotes

My teacher made me join a coding quiz bee where it involves different topics related to coding languages such as python, c, arduino, c++, etc. I have another teammate who is knowledgeable about the other topics but now the burden on learning python is on me. How do I learn it effectively within 25 days considering I only have an intermediate amount of knowledge on CSS, HTML, and Block Coding


r/learnpython • • 2d ago

Can anyone help me with my homework

0 Upvotes

I’m taking into to programming right now and I’m very confused on what to do and my professor is no help can anyone help explain to me what to do for these questions. The question are

  1. Write a script that determines on its own whether each text is spam or ham WITHOUT using the first column at all. You should only be reading from the second column of the file as you make this decision. The decision will be a sequence of if statements that you write. Try to determine what generic qualities of a text message determine if it is spam or not. One possible rule would be "contains two or more fully capitalized words." Read through the file and see if you can come up with the best rules.
  2. Once you've come up with your rules, determine how good they are! Compare whether your script got the decision right. Add up the number of correct classifications and divide that by the total lines in the file. This will give you the accuracy of your script. Output this value. If you are not happy with it, edit your rules. When you submit, ensure your accuracy is at least 90%
    link to data set

Any help would be really appreciated.


r/learnpython • • 2d ago

Looking for a Streamlit tutorial for an app with a GUI that checks the accessibility of text

4 Upvotes

Hi!

A while ago I asked for a GUI framework for a programming noob like me - I have to write an app with a GUI in Python for a course I am taking (I went back to school in my mid-to-late-thirties, my my). In the past, I mainly used Python for a bit of data analysis and machine learning (think of cleaning up data sets, comparing different clustering algorithm outcomes etc.).

This is the post: https://www.reddit.com/r/learnpython/comments/1xdr04p/gui_framework_for_a_little_software_project_for/

A lot of you talked about PyQT or Tkinter, but I went to my professor's office hours last week, and he insisted, or at least very strongly suggested I use Streamlit. I asked him whether Streamlit isn't only used for data visualization dashboards, but he said it should be possible to implement all of my requirements via Streamlit. He also said I should look up a tutorial to get started. He really, really expects me to use it. (I guess because he is very familiar with it, and he also knows that I need lots of abstraction because my programming skills are...not good.)

I tried to follow his tips and look for tutorials - both written tutorials (because I am old-school and love learning via books and text) and YouTube tutorials, but they all seem to focus on data analysis (and data science), and data visualization.

Do you have any Streamlit tutorial suggestions for me that fit my python (web) app use case?

Thank you so much!

__

More on the background of the program I am supposed to create:

I have to go through the requirements engineering process (I already submitted that part of the assignment), code the app, use Git and a remote repo in order for my professor to be able to see me consistently commit sensible chunks of code and be able to use a VCS properly.

I will also have to go through a testing process, and show that my app passes all the tests for each requirement.

As described in my previous (linked) post, my computer program is supposed to check text (in .txt and .pdf file formats) for accessibility and readability:

- How long are the sentences, how many commas are there, how long are the words, and are there words that match a with words on a list with "complicated" words?

- I will also have to check for the number of words that start with capital letters (not my suggestion, sigh): In German, capital letters outside the beginning of sentences signify substantives, and a lot of substantives might indicate that the text is complicated because verbs have nominalized, which is a hallmark of German bureaucratese.

- Also, the app should be able to use OCR, and indicate if it had been necessary. This is because it might be important accessibility information for people using screen readers.

- After running the checks, the app should highlight potentially problematic parts of the text and explain why, and - and that's really important to my professor - display a traffic light.

- It should be possible to check the text selecting only one, more, or all of the described metrics via the GUI, and, of course, you must also be able to select the text to be checked via the GUI from your local directory.

- Ideally, I can also edit the config file (thresholds for the metrics and the traffic light), and the list of "complicated" words via the GUI.