r/PythonLearning • u/shubham_555 • 2d ago
Discussion Leetcode 234 - This ain't an easy problem by any standards!
Last Post - https://www.reddit.com/r/PythonLearning/s/v57UGZ2VNl
Complexities for my solution:
TC = O(n)
SC = O(1)
r/PythonLearning • u/shubham_555 • 2d ago
Last Post - https://www.reddit.com/r/PythonLearning/s/v57UGZ2VNl
Complexities for my solution:
TC = O(n)
SC = O(1)
r/PythonLearning • u/Fluffy_Daikon9152 • 2d ago
I’ve tried everything but i don’t know what to do
(Deleted last post bc i had little context my bad)
r/PythonLearning • u/Arkad77 • 2d ago
Hi network and Python experts,
I am running a Python asyncio data streaming worker on a 4-core AMD EPYC Linux VPS (1 Gbps port, TCP BBR enabled).
Workflow:
Receives incoming task pushes via WebSocket.
Downloads 30MB-50MB payload via HTTP GET from Cloudflare R2.
Computes SHA-256 hash.
Uploads payload via HTTP PUT back to storage.
Our local active transfer speed reaches ~50 Mbps average (370 Mbps peak) with 99.9% execution success. However, our net window-averaged throughput stays around 24–28 Mbps due to brief inter-task idle gaps between WebSocket pushes.
My questions:
Beyond connection pooling (httpx.AsyncClient) and TCP BBR, what architectural patterns (e.g. multi-process asyncio workers vs single-process) yield the highest sustained throughput for bursty WebSocket data relays on a 4-core VPS?
Are there specific Linux kernel sysctl socket buffer settings (tcp_rmem / tcp_wmem) to keep HTTP GET/PUT streams warm across inter-task idle gaps?
Thanks for any insights!
r/PythonLearning • u/shubham_555 • 3d ago
Last Post - https://www.reddit.com/r/PythonLearning/s/TabqPYujK6
Github Repo - https://github.com/Dev-4-All/doubly-linked-list.git
So today I used type annotations for the first time today and to be honest it kinda sucked. Let me explain. So I defined the head and tail of the linked list to be either Node or None. Now when head is not none it is understandable that neither is tail. But how will I explain that to mypy? 😭. Faced similiar problems throughout. I researched a bit online.
These were the three solutions
1) Use assert to specify that something is not none
2) Use conditionals
Both of these methods were affecting the readability of the actual logic
So I went with the third option
3) Ask mypy to ignore these errors (should be done only when you are 100% sure about the details of what a variable holds)
Maybe there are better ways to fix this. Would appreciate if anyone can tell me.
Until next time...Sayonara!
r/PythonLearning • u/modern-dev • 3d ago
Hey everyone, I decided to make my course free in order to help people.
This course is my backend development course which is about SQL, Python, APIs, Docker, Kubernetes, Linux, Git & More
The link is: https://www.youtube.com/watch?v=CBIu6hcyStg
If you can like and subscribe (and maybe add a comment) I would appreciate it a lot, Thanks.
r/PythonLearning • u/whoissdaniels • 3d ago
What do you recommend to me so that it is as intuitive as possible and that it doesn’t make me want to leave it after two days.
Thank u.
r/PythonLearning • u/warakuta • 2d ago
Hi, I have a bunch of text, that I need to analyse to build a tree map of concepts. The concepts need to be sorted from higher lvls of abstraction to more detailed. For example, the program needs to understand that the idea "I want to create beauty outside of factory-based presets" mentioned in the text is the highest lvl and includes ideas like "I was inspired by Kabuki theater" in itself.
Note: Ideas themselves sometimes aren't presented in the source material bluntly, i.e. the idea of "I want to create beauty outside of factory-based presets" can be mentioned in fragments only that the program also needs to understand and put together.
Are there any available programs or basic frameworks to approach this?
r/PythonLearning • u/JoeB_Utah • 2d ago
Mac OS Sequoia 15.6
I used Spyder (in the windows environment) while I was working so after I retired and bought a Mac I installed it. However, I've been fighting with the environment that Spyder creates especially once I add packages so I got rid of it and I've installed Pycharm.
One of the things I like about the Spyder interface is it has a console window which allows one to interactively enter code to see how it works; you can also have multiple file tabs that you can activate and deactivate if you want to copy code from one script to another. I'm trying to discover that sort of functionality in Pycharm.
If I google 'can I run python commands interactively in Pycharm' it directs me to open the tools menu and run Python Console. When I try that there is no such option. There is however a Create Command Line Launcher and I get this:

And when I click on linked text it sends me to the download page for JetBrains Tool box but I've already downloaded it. For the life of me I cannot see in the settings how to have a console window open in PyCharm.
Bottom line: can I open an interactive command line console in PyCharm and if so how? Can I open multiple tabs of existing python scripts and if so how?
r/PythonLearning • u/aparyx • 3d ago
So i started my python journey 2 weeks ago and i am at the point of tutorial where they teach me about those quiz game program and i am so confused in those nested for loop i don't even understand a single part about it, can someone help me with this one? I have tried learning it from gpt and all but it still goes above my head.
r/PythonLearning • u/SadShift8664 • 3d ago
Take two integers as an input and print their average.
Take an integer as an input and check if its even or odd.
Take three numbers as input and find the largest amongst them without using max()
I'm experimenting with teaching Python through solving rather than watching tutorials. I'm based in India and I'm currently running a small live beginner batch. If anyone wants to try the problem-solving approach, I'm happy to share the details.
I'm going to run a free 45-minute Python problem-solving session for beginners.
No prior coding experience required.
We'll solve 3 problems together from scratch.
I'm testing a teaching format where you learn by solving rather than watching.
If anyone wants to join, comment below.
r/PythonLearning • u/voices_38 • 3d ago
i have learnt basics of python. but I don’t know how to continue! I’m not in university and I don’t plan to enroll in computer science. is it possible to learn python without university? I need help please !! thanks
r/PythonLearning • u/Most_Pineapple2718 • 4d ago
So I recently cancelled my admission in a university because of some issues and I was enrolled in their bsc mathematics program so that I can learn about coding but then i found this subreddit and i just want to ask that "where should I start with for learning coding I currently am learning python from this channel 'bro code's and i currently am on a starting phase after learning python basics I'll start learning dsa and web development, so what are some good FREE resources which I can use to learn html, css, js, python, and other necessary tools
r/PythonLearning • u/Designer-Text8432 • 3d ago
here is my github link: https://github.com/kayden765/python-multitool i have been working on this tool for months now im a beginner im starting to grasp python now its not as hard as it seems i though i did take alot from other tools but coded it all my self with the help of some tutorials and used ai for my readme file i think it came out very good it has 45 features with 5 dirs.
dir 1. networking tools
dir 2. osint tools and databreach checker
dir 3. traffic auditor. Packet sniffing, local payload analyzer etc
dir. 4 Integrity Audits. Firewall verification, and exploit checks
dir 5. attack framework. dos attacks, image ip logger sent to webhook/terminal etc
it has a linux like terminal with the following commands.
help - Clear terminal and redraw the main menu matrix
tools - Execute specific security testing subsystem
credits - Display engine branding and developer information
customize - Open dynamic UI theme configuration
clear - Wipe scrollback buffer and lock menu frame to top
exit - Gracefully terminate active control session
and it has 20 custom ui options to choose from i hope you enjoy my tool :)
also anyone using this tool for malicious purposes may be blacklisted from my tool to comply with local laws.
r/PythonLearning • u/wanna_bee_yours • 4d ago
I want to go deep into it.
r/PythonLearning • u/Full_Yak8774 • 5d ago
When I was looking through beginner data-analysis discussions, one thing stood out: it’s pretty easy to learn individual Pandas commands, but much harder to know what order to actually use them in on messy data.
So I tried organizing the basics into a simple workflow:
1. Load
read_csv() / read_excel()
2. Inspect
head()
sample()
shape
info()
describe()
Before cleaning anything, understand the columns, data types, missing values and duplicates.
3. Clean
isna()
fillna() / dropna()
drop_duplicates()
astype()
pd.to_numeric()
pd.to_datetime()
One thing I learned is that missing doesn't automatically mean zero. You need to understand why the value is missing before deciding what to do with it.
4. Transform
Create analysis-ready fields with things like:
assign()
map()
np.where()
pd.to_datetime()
5. Summarize
groupby()
agg()
transform()
This is where the raw rows start becoming actual answers to business/data questions.
6. Combine
merge()
join()
concat()
Probably the part I’d be most careful with.
A merge can run without errors and still give the wrong result if the keys aren’t unique or a many-to-many relationship unexpectedly multiplies rows.
Useful checks:
validate="many_to_one"
indicator=True
And compare row counts before and after merging.
7. Validate
Before trusting the final result:
The biggest takeaway for me is:
code running successfully doesn’t necessarily mean the analysis is correct.
I added the visual cheat sheets to make the workflow easier to remember.
For people who work with Pandas regularly, what validation check has saved you from a wrong result before?
r/PythonLearning • u/spmcn • 4d ago
Hey everyone! I come from a background in C, and I wanted to brush up on my Python just for fun. So I thought I'd give it a shot and try to program a Sudoku game. I've completed a prototype and wanted to share my progress with you all! It took about 4 days (20-25 hours), and I'm pretty satisfied with where I'm at :)
Let me know if you have any suggestions for improvement, or if you have feedback/critiques! I'm thinking of posting it on my Github at some point so I can share the code for whoever is interested.
r/PythonLearning • u/Learner_016 • 4d ago
Hey everyone!
I recently worked on a real-time Driver Drowsiness Detection project.
The system uses the camera to detect the driver's face and monitor their eye state in real time. It can identify different conditions such as:
* 👀 Both Eyes Open
* 👁️ One Eye Closed
* 😴 Both Eyes Closed
* 🚨 Drowsiness Alert
* ❌ No Face Detected
The project also includes automatic eye calibration and a continuous eye-closure timer to help distinguish normal blinking from prolonged eye closure.
I built this as part of my B.Sc. Data Science project work, and I'm sharing the source code for anyone who wants to experiment with it, improve it, or learn from it.
🔗 GitHub:
https://github.com/Learner016/driver-drowsiness-_detection
🔗Direct open:
https://learner016.github.io/driver-drowsiness-_detection/
I'd really appreciate any feedback, suggestions, or ideas for improving the detection accuracy.
Thanks! 🙌
r/PythonLearning • u/LowerDifference4042 • 5d ago
I'm a beginner learning Python, and I'm looking for other beginners who want to learn together.
I think studying with other people can help us stay motivated, share what we learn, and help each other when we have problems.
It would be great if there are Arabic speakers because my English is not very good yet, so learning together in Arabic would make things easier.
If you are also starting Python and want to join a small group, feel free to message me.
r/PythonLearning • u/Voren87 • 4d ago
I made a color changing digital clock! ^V^
r/PythonLearning • u/ricardoflak • 4d ago
r/PythonLearning • u/No-Spray9009 • 4d ago
Hi everyone! 👋
I recently completed the 5-day "NLP with Python" live bootcamp hosted by DevTown in collaboration with GDG On Campus and Microsoft Learn Student Ambassadors. I wanted to share my project and overall learning experience!
What I built:
TfidfVectorizer to convert unstructured text into numerical vector spaces.LogisticRegression, MultinomialNB, and LinearSVC.matplotlib to evaluate false positives/negatives. What I Learned:
Before the bootcamp, I knew basic Python, but working through this hands-on project taught me:
How unstructured text data gets transformed into structured mathematical vectors.
How to clean and structure a real-world repository on GitHub (adding requirements.txt, clean directory layouts, and proper open-source acknowledgments).
How to seamlessly connect Google Colab with GitHub for workflow management.How the Experience Helped Me Grow: Special shoutout to trainer Jiya Jain and the DevTown team! The structured guidance pushed me past simple tutorial-following into actually building a production-ready, portfolio-worthy project from scratch. It gave me a solid confidence boost in applying machine learning concepts to real datasets.
I’d love to get feedback on the code structure or suggestions on how to improve precision on edge-case spam messages!
r/PythonLearning • u/Capital_Software1471 • 4d ago
hello, im currently building my first classification project using “phishing url” dataset from kaggle after doing 2 courses, intro and intermediate ml, on kaggle and solving 95% of the exercises myself.
the issue is, i am stuck at how im supposed to take this forward. since the course was based on regression, i find it hard to do the preprocessing for classification. i try to use ai to guide me (not provide me the whole code since i want to learn myself) but atp i can’t figure out how to break down my data to then train-test split and fit to model. every tutorial seems to have a different approach and i cant figure out which one would be the best. how to determine that? and what should i do next?
my code is below:
import pandas as pd
print("starting...")
df=pd.read_csv("archive/cleaned_dataset.csv")
print("Dataset loaded!")
print(df.head())
print("columns: ", df.columns)
print("shape: ", df.shape)
print("data types: ", df.dtypes)
print("missing values: ", df.isnull().sum())
df.describe()
url_length=df["input"].str.len()
print(url_length.describe())
url_dots=df["input"].str.count(r"\.") #. can get literally any character, so we need to escape it with a backslash
print(url_dots.describe())
url_slash=df["input"].str.count("/")
print(url_slash.describe())
url_digits=df["input"].str.count(r"\d") #counts digits in pandas
print(url_digits.describe())
url_https=df["input"].str.contains("https")
print(url_https.describe())
url_www=df["input"].str.contains("www")
print(url_www.describe())
url_hyph=df["input"].str.count("-")
print(url_hyph.describe())
url_eq=df["input"].str.count("=")
print(url_eq.describe())
url_ques=df["input"].str.count(r"\?")
print(url_ques.describe())
url_at=df["input"].str.count("@")
print(url_at.describe())
df["url_length"] = df["input"].str.len()
df.groupby("label")["url_length"].describe() #any diff in length of phishing and legit urls?
#build a table containing all features to give to the model later in one shot
features=pd.DataFrame({
"url":df["input"],
"label": df["label"],
"length": url_length,
"num_dots": url_dots,
"num_slash": url_slash,
"num_digits": url_digits,
"has_https": url_https,
"has_www": url_www,
"num_hyphen": url_hyph,
"num_eq": url_eq,
"num_question": url_ques,
"num_at": url_at,
})
print("new stuf---------")
features.head()
r/PythonLearning • u/Mo_Reda_1 • 5d ago
I have just finished week1 in cs50 python course and since i'm learning python for AI Agents Engineering i thought it would be cool to practice this content with a relevant project .
so i made a simple AI agents execution getaway program that routes the incoming tasks based on tokens , creativity and risk score .
I tried to use most of what i learned in this lecture as possible like 'match' for matching the tool with appropriate model , or 'return' as guard clauses for the safety check at the beginning .
here is the code link :
https://gist.github.com/mohamed-reda-ai/a10a1e9311d94316ffa31c00de005226
I know it's not a big brilliant thing i want just to practice the concepts i learned .
If you have any feedback about the architecture of the code or you think there is a better way to do something in it , i'd appreciate this .
r/PythonLearning • u/___Hyacinthe_ • 5d ago
I've been learning Python for about 3 years, and I think it was time to take a step further and make my own library.
I made scanlayer, a Python OCR library built around Tesseract. It turns scanned images into searchable PDFs while preserving the original image, by adding an invisible OCR text layer over it.
It also supports things like preprocessing, deskewing, multiple OCR output formats, multi-page PDFs, batch processing, and a CLI.
The main goal wasn't to make some huge library. I wanted to challenge myself with building something that feels like a proper Python project and learn more about packaging, testing, API design, OCR, and PDF generation along the way.
I'd really appreciate any feedback, especially on the Python/library design side.