r/learnpython • u/Maleficent-Roll-9255 • 4d ago
learn python for beginners
Hi all, I'm a complete beginner and would like to learn Python. What are the best resources and steps to get started? Thanks!
r/learnpython • u/Maleficent-Roll-9255 • 4d ago
Hi all, I'm a complete beginner and would like to learn Python. What are the best resources and steps to get started? Thanks!
r/learnpython • u/spedgenius • 4d ago
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.pypyproject.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=compatI 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 • u/oklopo • 4d ago
I'm building my first project, starting with the Wokwi ESP32 simulator. My program was working until I tried adding a rotary encoder. I keep getting errors. Here's the code and error message. The ssd1306.py file is standard. I've tried changing things over to SoftI2C but was still having issues.
I took the encoder code from here.
Error:
Warning: I2C(-1, ...) is deprecated, use SoftI2C(...) instead
Traceback (most recent call last):
File "main.py", line 27, in <module>
File "ssd1306.py", line 116, in __init__
File "ssd1306.py", line 36, in __init__
File "ssd1306.py", line 61, in init_display
File "ssd1306.py", line 121, in write_cmd
OSError: [Errno 19] ENODEV
from machine import Pin, I2C
import ssd1306
import network
import urequests
import time
import random
# ESP32 Pin assignment
i2c = I2C(scl=Pin(22), sda=Pin(21))
button_pin = Pin(27, Pin.IN, Pin.PULL_UP)
direction_pin = Pin(26, Pin.IN, Pin.PULL_UP)
step_pin = Pin(25, Pin.IN, Pin.PULL_UP)
# I2C variables
ID = 0
SDA = Pin(0)
SCL = Pin(1)
i2c = I2C(scl=SCL, sda=SDA)
# for tracking the direction and button state
previous_value = True
button_down = False
#oled details
oled_width = 128
oled_height = 64
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c)r/learnpython • u/Ruthawd-Hill4e • 5d ago
I'm trying to work through the python retrieval step for a customgpt.ai project. Say an association stores its approved policy and a replacement draft in the same collection. They both say "membership renewal" in the title. The draft has a new deadline, which makes it a useful test of whether the approval filter is doing its job
The shape I'm considering has a status and a staff approval ID on each record. The fetch function would query approved records. The function that builds the context would check that state again before passing anything to the assistant. I'd like to give the test a draft with a stronger title match and see what comes out of both functions
How would you write that test in python? I'd appreciate a small example or a suggestion for what to stub so I can tell which layer rejected the draft
r/learnpython • u/nnt-3001 • 5d ago
Hello everyone, I'm a computer science student working on a small project about k-medoid clustering algorithms called CLARANS and FastCLARANS. I've been developing this project for quite some time and would like the community to review it. Initially, I intended to submit it to the Journal of Open Source Software, but after careful consideration, I realized it wasn't quite suitable. You can find more information at this repository: https://github.com/ThienNguyen3001/scikit-clarans.git
What I'd like feedback on
- Is the code structure okay, or could it be improved
- Anything I may have gotten wrong
- What I could add next
Thanks for the feedbacks!
r/learnpython • u/Desperate_Muffin_778 • 5d ago
As the title suggests,I’m a complete beginner starting from zero,I don’t even know what to call the basics,but learning python seems interesting an I’d really love to learn it, is there a structure to follow? I don’t know where to start from for I have no knowledge of programming
r/learnpython • u/Live-Chemistry-3793 • 5d ago
any good resources?
r/learnpython • u/NoSpace5716 • 5d ago
Hi, I'm a junior data analyst but not able to get a good job with a good salary. So i decided to do marketing and by my luck I got a job as a marketing executive but tbh I don't want to do this job. I know python very well but haven't done any projects. So today I decided to do DSA in python but when I went on the internet and social media, people were saying “doing DSA in python is a waste of time, AI will take your job in the next few months, and so many things ” and then I got scared and confused. Please help me. Should I do it or not, is there any chance of getting a job after doing DSA or not?
r/learnpython • u/winterblute • 5d ago
It boggles me how people were able to master or visualize algorithms before the time of AI to break them down.
I wanted to know if the veterans here had any advice to help with visualizing or learning algorithms more efficiently?
r/learnpython • u/Forteza1990 • 5d ago
git clone https://github.com/2scraper/shein-scraper.git
cd shein-scraper
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-playwright.txt
playwright install chromium
cp .env.example .envpython3 playwright_scraper.py \
--query "summer dress" \
--max-results 20python3 playwright_scraper.py \
--url "https://us.shein.com/dsbayvkj-p-33704388.html"python3 diff_runs.py previous.json current.jsonsku is shared across colours and sizes, so you get one row per product. On a product page the price is the lowest variant price.--sort is recorded in the results but not sent to SHEIN yet.r/learnpython • u/ompossible • 5d ago
I have recently completed the basics of Python and want to improve my problem solving skills.
Can anyone recommend a good exercise book that starts with basic problems and gradually moves to intermediate and advanced ones? Preferably with solutions included.
Would love to hear your recommendations. Thanks!
r/learnpython • u/Valuable_Corner4797 • 5d ago
I didn't like the Windows Calculator, so I decided to develop my own CMD-based calculator. It's open-source, so anyone is welcome to use it!
r/learnpython • u/PeakMedium • 5d ago
Using https://pythonsandbox.com/turtle I've created this simple drawing app and it works. But when I try to save it I get a "The server returned a "405 Method Not Allowed"" error message. Tried multiple browsers, incognito mode, turned off extensions, multiple computers. No luck. Any suggestions?
import turtle
t = turtle.Turtle()
t.speed(5) # 1:slowest, 3:slow, 5:normal, 10:fast, 0:fastest
shape = "start"
while shape == "start":
shape = input("Would you like to start or stop drawing a square?")
if shape == "start":
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
elif shape == "stop":
break
r/learnpython • u/h4rln • 5d ago
I'm 19, studying computing in college. I built this to understand how blockchains work.
Repo https://github.com/h4rl0/mini-chain
-Genesis block, chain of blocks linked by SHA-256 hashes
-Proof of work with adjustable difficulty
-Chain validation
-Flask API with CORS enabled so a front end can talk to it
Python, Flask, flask-cors, requests, hashlib
-Is the code structure okay, or could it be improved
-Anything I may have gotten wrong
-What I could add next
r/learnpython • u/Name_Less360 • 5d ago
Good afternoon, everyone,
I’m working on a program that takes a picture from Google Maps, and you can draw an area that you want to measure. The GUI is complete, and the entire structure of the program is complete; however, when I run the program, the measurement from Google and my program are different, and I can't figure out why. I’m using the lat and lo that Google gives from their URL and adjusting it by the zoom also given by the URL, and still the measurement is way off
r/learnpython • u/Lyaw_Lyawa • 5d ago
I mean, any sort of bot, it's not for a specific porpuse, I'm just interested and want to learn about it.
r/learnpython • u/Lynnsicle • 6d ago
I'm currently using torch for training the neural network that my lab uses for research. It was working fine last night. Windows updated before shutdown. Now I have this error when I attempt to run the script. Any help to fix this?
%runfile 'C:/Users/Owner/Desktop/docs/CHB-MIT EEG Dataset/chb_main_v10_Experiment_A3.py' --wdir
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
File c:\users\owner\desktop\docs\chb-mit eeg dataset\chb_main_v10_experiment_a3.py:14
11 from sklearn.model_selection import train_test_split
12 from sklearn.metrics import f1_score, recall_score, confusion_matrix, roc_auc_score
---> 14 import torch
15 import torch.nn as nn
16 import torch.nn.functional as F
File ~\anaconda3\Lib\site-packages\torch__init__.py:309
305 raise err
307 kernel32.SetErrorMode(prev_error_mode)
--> 309 _load_dll_libraries()
310 del _load_dll_libraries
313 def _get_cuda_dep_paths(path: str, lib_folder: str, lib_name: str) -> list[str]:
314 # Libraries can either be in
315 # path/nvidia/lib_folder/lib or
316 # path/nvidia/cuXX/lib (since CUDA 13.0) or
317 # path/lib_folder/lib
File ~\anaconda3\Lib\site-packages\torch__init__.py:292, in _load_dll_libraries()
288 err = ctypes.WinError(last_error)
289 err.strerror += (
290 f' Error loading "{dll}" or one of its dependencies.'
291 )
--> 292 raise err
293 elif res is not None:
294 is_loaded = True
OSError: [WinError 4551] An Application Control policy has blocked this file. Error loading "C:\Users\Owner\anaconda3\Lib\site-packages\torch\lib\caffe2_nvrtc.dll" or one of its dependencies.
r/learnpython • u/ThinCreme1098 • 6d ago
Hello, I’m a newbie, and I’m wondering how to practice Python as a newbie.
r/learnpython • u/urschoolshooter • 6d ago
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 • u/GoodIsland8523 • 6d ago
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 • u/hff22 • 6d ago
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 • u/Dreameruser666 • 6d ago
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 • u/Dragoran21 • 6d ago
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 • u/Sad_Requirement5163 • 6d ago
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:
Thanks for any advice!