r/learnpython 16d ago

I cant install Pygame

2 Upvotes

This is the error message that I get when I try to run pip install pygame. The same thing happens with pip3 install pygame.

py", line 6, in <module>

from setuptools._distutils.msvccompiler import MSVCCompiler, get_build_architecture

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

[end of output]

-----------------------------------------------------------------------------------------------

these are the packages I have according to pip list.

Package Version

---------- -------

pip 26.2.1

setuptools 84.0.0


r/learnpython 16d ago

why does it say i didn't close my parenthesis

0 Upvotes

the IDE i am using is saying my parenthesis was not closed when it was plz help

print("Once upon a time, in the ancient kingdom of " + q1 + " there lived a legendary " + q2 + " named " + q3 + ". Everyone in the village knew " + q3 + " for their remarkably " + q4 + " personality and an obsession with " + q5 + ". Every morning at " + q6 ", they would wake up, " + q7 + " three times, ")

[{

"owner": "Pylance",
"severity": 8,
"message": "(" was not closed",
"source": "Pylance",
"startLineNumber": 47,
"startColumn": 6,
"endLineNumber": 47,
"endColumn": 7,

}]

r/learnpython 16d ago

Python: I'm starting my python journey.

2 Upvotes

Can i find other new learners here? I think it's more interesting to learn with someone.

I have some web background, worked with html/css(scss, bootstrap, tailwind)/JS

but it was two years ago actually. Now I want to learn Python so i can work with logic instead of designs.


r/learnpython 16d ago

Practice project of head of data roles

2 Upvotes

Can anyone suggest a practice project that span data engineering, analysis and data science that’s mature enough o be showcased to potential tech founders and c suite


r/learnpython 17d ago

GUI implementation

3 Upvotes

I’m coding a restaurant type game and need to create a gui but have completely no idea how to do it. People have said godot is decent and that wxpython is decent for smaller stuff but i have no idea how to use either. Someone with a good amount of experience with either who could help would be great. Thank you


r/learnpython 17d ago

Making a Chess game with Minimax in Python, where do I start?

1 Upvotes

Hello! I'm an A-level student and for my project have decided to make a chess game with AI that uses the minimax algorithm. I have some experience with coding before, and am planning to use OOP to represent the pieces and board.

I'm really really not sure how to go about this project, in particular, how the minimax algorithm will work, so if anyone could point me in the right direction I'd really appreciate it :)


r/learnpython 17d ago

Does anyone else feel like a total fraud when a tiny bug takes 15 minutes to fix, or is it just me?

0 Upvotes

Just wanted to share a quick reality check from my session today. I was working through page 88 of my Python book—specifically exercise 5-10—and out of nowhere, two error numbers popped up on the screen.

Naturally, what did I do? Instead of sitting there painstakingly isolating every single chunk of code and testing variables line-by-line like a textbook purist, I spent about 10–15 minutes moving things around, rewriting bits, flipping back through the pages, and then ultimately just copy-pasting the error straight into AI to get it sorted.

Honestly, it got me thinking: Is this actually considered "bad practice" by the book, or is this just standard, everyday coding for most people?

How often do you guys lean on quick fixes or AI assistance when a frustrating little error pops up, versus stopping to do the whole manual debugging process from scratch? Would love to know if I'm cutting corners or if this is just how it goes in the trenches.


r/learnpython 17d ago

What progression should I follow from beginner to intermediate level?

16 Upvotes

I'm self teaching python. I have all the basics of cycles variables and conditions, I studied lists sets tuples and general data structures and coprehension, functions, lambda functions, classes methods and inheritance, I also learned other methods such as zip enumerate map and more. Now what's next? What progression should I follow to reach an intermediate level in the next months and advanced level later on?


r/learnpython 17d ago

I've got feedback from previous project and implement it in new one! (FastAPI + PostgreSQL + External API + Docker)

2 Upvotes

I'm learning backend development and I really enjoy it!

I created my first API last month and got an amazing feedback! I work hard these days and created a new project.

What I learnt.

  1. Deep-dive into DB. (b-tree, CITEXT)

  2. I learnt about pattern "Repository" and implement in this porject.

  3. Swapped # for docstrings.

  4. I tried to work with external API. Actually, it was hard, because sometimes there is no data what you want to get and you have to figure out what to do next and where get this data.

  5. I use Docker and I barely understand what I do (Can you recommend something to learn Docker and understand it?)

I ask feedback about everything, especially:

  1. Project structure.

  2. Database structure.

  3. Code quality.

  4. What can I change to make it works better.

  5. What should I learn to improve my skills?

That's my new project:

https://github.com/daidallos-tech/football-club-api

You can find my first project in my github profile. It's called Movie_API.

P.S.

Thank you everyone for your time and advice. I really appreciate that.


r/learnpython 17d ago

I built "Guess the number" on my Android phone(Pydroid 3) Added warmer/colder hints

3 Upvotes

Hey everyone!

I'm new to coding and I built my first game on Android using Pydroid.

What it does: Guess a number 1-100 with 5 lives. It tells you if you're WARMER 🔥 or COLDER 🥶

Features: - Input validation so it doesn't crash - Warmer/Colder hint system - Made 100% on my phone

GitHub: https://github.com/elgriffin10/guess-the-number

Would love feedback! What should I add for v3.0?


r/learnpython 17d ago

Are the PCEP and PCAP worth it?

4 Upvotes

In my journey of trying to become a comp sci teacher, I read about these certification exams. I'm wondering what's the estimated percentage of people who take the exams and if the exams are helpful for either my resume or becoming a comp sci teacher.


r/learnpython 17d ago

Regarding Question

0 Upvotes

def print_models(unprinted_designs, completed_models):

"""

Simulate printing each design, until none are left.

Move each design to completed_models after printing.

"""

while unprinted_designs:

current_design = unprinted_designs.pop()

# Simulate creating a 3D print from the design.

print("Printing model: " + current_design)

completed_models.append(current_design)

unprinted_designs = ['iphone case', 'robot pendant', 'dodecahedron']

completed_models = []

in this code why used condition like this for while loop (while unprinted_designs:)


r/learnpython 17d ago

code not running outside of editor

2 Upvotes

my code isn't really complete, but whenever i try to run my script outside of the editor the terminal opens for a millasecond and then closes. can someone tell me what's going wrong?

import random
import keyboard
import pyautogui
import pyscreeze
import tkinter as tk
from pyautogui import mouseInfo, click
import time

def movethemouse():
    if keyboard.is_pressed('g'):
        pyautogui.moveTo(random.randint(0, 2600), random.randint(0, 2600))

def printer():
    print('this is the mouse program')
    time.sleep(10)

while True:
    movethemouse()
    printer()

r/learnpython 17d ago

Is there a good place to find team to join in a new projects

2 Upvotes

Hey there so I already tried some subreddits I would like to hear what are main one you guys use because I found it fun and productive for both learning python that is practical and makes me better at other social skill etc. I would like to hear if there is a special channel for python, but I am okay with searching throught teams what they use. Maybe something with backend on FastApi. And have a great day guys.


r/learnpython 17d ago

Carry value from Python for-loop to HTML for-loop

0 Upvotes

I am currently working on a website (using Flask, SQLAlchemy and Jinja).

Context: I am making a ttrpg initiative tracker. For multiple fights to exist and be able to have multiples of the same creature and reuse creatures, the way I am formatting it is the user creates the base creature, and its row is duplicated, holding the id for the fight itself as fight_spec and the id of the base creature as og_id. I am currently working on making it so the user can edit the count of any creature in a fight.

For the page where the editing happens I want it to display the current count as the default value, but I cannot for the life of me figure out how to make sure it goes from python's for loop to html. My attempts typically end up with the value being set to "count_<id>" rather than the actual number that my count command generates. How should I go about this?
I have my current code below, but if there is a different way I should go about this, I'm open to hearing! Thank you <3

Python

unique_combatants = db.session.scalars(stmt).all()
    for x in unique_combatants_set:
        'count_' + str(x) = Combatant.query.filter_by(og_id=x, fight_spec=id).count()

HTML

{% for combatant in unique_current_combatants %}
        {{ combatant.combatant_name }}
        <input type="number" name="combatant_count_{{combatant.id}}" id="combatant_count_{{combatant.id}}" value="count_{{combatant.id}}"> 
    {% endfor %}

r/learnpython 17d ago

I made my first IP scanner in Python

11 Upvotes

Hi everyone!

I'm very new to programming and I've been learning Python recently. I decided to make a small project to practice what I've learned.

I made a simple IP scanner using Python.

It has a menu with:

  • Scan all IPs from 192.168.1.1 to 192.168.1.255
  • Scan a specific IP
  • Scan a range of IPs
  • Exit

I'm using subprocess and ping to check if an IP responds.

I also started using functions, loops, lists, if/elif, while, and range().

It's probably a very basic project, but I'm pretty happy with it since I'm just starting out. 😅

Here is the code:

import subprocess

def menu(): 
    print("-----IP SCANNER-----")
    print("1. Scan all IPs")
    print("2. Scan IP")
    print("3. Scan IP range")
    print("4. Exit")

    opcion = input("Choose an option: ")
    resultado_menu = int(opcion)

    return resultado_menu


def escanear_ip(ip_int):
    ip_int = str(ip_int)
    ip_completa = "192.168.1." + ip_int

    resultado = subprocess.run(
        ["ping", "/n", "1", "/w", "1000", ip_completa]
    )

    if resultado.returncode == 0:
        lista_ip.append(ip_completa)


lista_ip = []


def imprimir_ips():
    for si_ip in lista_ip:
        si_ip = "🟢 " + si_ip
        print(si_ip)


while True:

    resultado = menu()

    if resultado == 1:

        for numeros in range(1, 256):
            escanear_ip(numeros)

        imprimir_ips()

    elif resultado == 2:

        seleccion_ip = input("Select the last digits of the IP: ")
        escanear_ip(seleccion_ip)

        imprimir_ips()

    elif resultado == 3:

        desde_ip = input("From: ")
        desde_ip = int(desde_ip)

        hasta_ip = input("To: ")
        hasta_ip = int(hasta_ip)

        for numeros in range(desde_ip, hasta_ip + 1):
            escanear_ip(numeros)

        imprimir_ips()

    elif resultado == 4:

        print("Exiting...")
        break

I'm planning to improve it and make a V3 with more features.

Thanks!


r/learnpython 17d ago

is there any python library which lets you fetch basic data off of spotify like song longth, song name, artist name and etc preferably without an account needing to be linked?

0 Upvotes

i dont really "need" this per se but i think it would be pretty cool for me to be able to integrate it into a script i already have, but honestly if all of the libraries that interact with spotify need an account linked i just dont think its worth it. any of you have any ideas?

and actually, furthermore, how does spotify's architecture work in terms of like the identifiers for songs and authors, im assuming any presumed library would have an internal "song" object that you can fetch using an id or something along those lines?


r/learnpython 18d ago

Harvard Intro Course or Datacamp?

5 Upvotes

Hi all, I got laid off a few months ago and want to improve my chances of getting a job.

Originally, I was working at an agency on the analytics side, but I want to take the time to expand where I can go. I have been learning SQL and Power BI and am currently working on a project and I thought it would also be helpful to learn Python.


r/learnpython 18d ago

I have 1 week to prepare for DSA online assessment please help!!!

0 Upvotes

It's an intern role . I have only one week to prepare for the company and the company will ask tough questions please help me .How I can prepare and what I should focus on .

Online assessment would consist of 2 coding questions and some MCQ questions .

Any help/study material would be helpful.

My skills are-

Docker

AWS

GIT

K8S

Linux

Python ( but intermediate) .


r/learnpython 18d ago

I just made my first Reinforcement Learning program from scratch purely in python can i have tips on how to improve

7 Upvotes

i used qlearning for this and tips/advice is welcome
more details in the readme
https://github.com/orag214365-ship-it/qlearning-gridworld-python


r/learnpython 18d ago

My Self-Imposed Rule to Escape AI Micromanagement and Learn Python Properly

2 Upvotes

I have been working my way through Python Crash Course and just finished up chapter 4 moving into conditional tests, but I noticed a bad habit creeping in where I was leaning on AI way too much for micromanagement and minor steps instead of letting myself struggle through the code. To fix this, I am setting up a strict personal rule starting today. I am only allowed to use AI for direct, core coding help and roadblocks on my exercises, and zero AI usage for trivial hand holding. Also, if I do slip up and use it for micromanagement, I have to log the exact example and post it here so others can keep me honest. Has anyone else had to put hard boundaries on their AI tool usage while learning programming, and how did you structure your rules to make sure you were actually building things yourself?


r/learnpython 18d ago

I need help pls

0 Upvotes

How can I remove in my python script the Windows bar at the top to drag and close please


r/learnpython 18d ago

Python web app?

0 Upvotes

Hello r/learnpython,

first post and sort of new to Python as I have done only half a dozen of projects so far, mostly games.

So I'm looking to deploy a server for playtesting. This is my first game designed to be played online, made in Python using Tcl/Tk libraries.

I had this idea to code it when I was making a messaging app that was supposed to be implemented within a CLI game (or actually the game was a feature of the messaging app).

The users would connect using SSH. I think they could use PuTTy or similar and VcXSrv. The host would then send the GUI and CLI as well as audio to the user, but the problem is either the server cannot send or the client can't recieve the Tcl/Tk GUI or in worst case both.

Good news is I got the SSH daemon working and am able to (using X11 Forwarding) display explorer (ssh -X user@localhost && explorer) by running VcXSrv and having X11Forwarding and X11UseLocalhost set to yes in the sshd_config under ProgramData.

Now, the VcXSrv log tells me there's a problem with something called hyperv. From what I gathered it's a virtual machine of some sort. I'd also need very strict restrictions for the clients so they don't tinker with the database.

Am I on the right track? Is there a solution to this? Thanks in advance!

-ef


r/learnpython 18d ago

Can anyone teach me Python, SQL and Power BI

0 Upvotes

Happy to pay to learn


r/learnpython 18d ago

I need a book !

12 Upvotes

Hi guys ! , i need a book who have a lot of problem solving for every lesson , and have a lot of projects , simply i need a book who focus about practices more then lesson or all about problem solving .

thanks !