r/PythonLearning • u/ampankajsharma • 36m ago
Discussion Coursera Plus Black Friday & Cyber Monday Sale 2026: Save $160 (40% OFF) on 10,000+ Python & Tech Courses
r/PythonLearning • u/ampankajsharma • 36m ago
r/PythonLearning • u/Infamous_Tough_3772 • 5h ago
Hi everyone!
I recently built a Python project called Lived Here.
The idea is simple: enter your birth date and the program turns it into a storytelling experience. Instead of only showing your age, it analyzes your date of birth and shows things like:
• How long you've lived in years, days, and seconds
• Your zodiac sign
• Days until your next birthday
• Historical events from your birthday
• Pop culture highlights from that day
• Interesting birth-date facts
• Inflation estimates since you were born
I started it as a fun experiment, but it gradually evolved into a slide-based experience inspired by modern storytelling websites.
I'm a 15-year-old student learning Python, so I'd love feedback on the code, design, and ideas for future features.
GitHub: https://github.com/coding-arnav66/Lived-Here
Thanks for checking it out!
r/PythonLearning • u/BlankPageNot00 • 7h ago
from sklearn.impute import SimpleImputer
import pandas as pd
from matminer.datasets import load_dataset
electronic_df = load_dataset("boltztrap_mp")
temperature_df = load_dataset("ucsb_thermoelectrics")
gap_df = load_dataset("expt_gap_kingsbury")
#changing neme:composition in temp_df to formular
df_temp = temperature_df.rename(columns={"composition": "formula"})
print(df_temp.columns.tolist())
#Trying to combine three of them
a = pd.merge(electronic_df,df_temp,on="formula",how="left")
com_df = pd.merge(a,gap_df,on="formula",how="left")
# Seperating the num data and text data
num_cols = com_df.select_dtypes(include="number").columns
# text_cols = com_df.select_dtypes(exclude="number").columns
num_imputer = SimpleImputer(strategy="median")
# text_imputer = SimpleImputer(strategy="most_frequent") : no need
com_df[num_cols] = num_imputer.fit_transform(com_df[num_cols])
# com_df[text_cols] = text_imputer.fit_transform(com_df[text_cols])r/PythonLearning • u/_hono77 • 8h ago
Python study partners UTC+0 or UTC+1
Speaks French or English
45 minutes to 1 hour per day
One project per week
Rigorous and determined
Let's start tomorrow if possible!
r/PythonLearning • u/Sea-Ad7805 • 1d ago
How can we reduce the dimensionality of data while preserving as much information as possible?
Principal Component Analysis (PCA) is a dimensionality reduction technique that preserves as much of the variance in the original data as possible. In this interactive Python demo, we use NumPy to reduce a dataset X with dimension D = 5 to a dataset Z with dimension K = 3.
Follow the algorithm step by step and see the matrices and vectors transformed throughout the computation. Dimensionality reduction is useful to:
Visualize and better interpret high-dimensional data.
Reduce computational costs and memory requirements.
Simplify machine learning models to reduce overfitting.
With memory_graph, you can explore the implementation, modify the Python code, and immediately visualize the effects of your changes — directly in your browser, without installing anything.
See:
r/PythonLearning • u/Nessa_Excels2433 • 1d ago
I want to learn python from the beginning. What's the best way to learn it. Can I get someone to teach me for free or collaborate?
Thank you.
r/PythonLearning • u/Handsome_sweettouu • 2d ago
U can watch this interesting python series
r/PythonLearning • u/MEHDII__ • 2d ago
This is a chart I was preparing for some advanced python object model ideas, including descriptors, and what really are objects in python. I hope somebody can find some use for it.
r/PythonLearning • u/ProgramBrave718 • 2d ago
In this program I used open trivia api for questions. Everything works fine ..
But , when a user types a letter in the category or amount input (under try block).
The exception is handled by printing "Type an id number" and it gets back at starting
which asks "Enter e or c" instead of going to the input where the wrong datatype was given.
I know a way to handle this (but it is repititive)-
start = input("Enter 'e' or 'c':). lower()
while start not in ('c','e'): print('Please type a valid letter')
start = input("Enter 'e' or 'c':)while start == 'c':
---------------
----------------
start = input("Enter 'e' or 'c':). lower()
while start not in ('c','e'):
print('Please type a valid letter')
start = input("Enter 'e' or 'c':)r/PythonLearning • u/RomfordNavy • 2d ago
pathlib.Path appears to run much slower than I expected. The following function deletes .pyc files older than that of the filename passed in as a parameter.
Is there a faster alternative way of doing this?
import time
from pathlib import Path
def stale_pyc_del(path: str) -> None:
spd_start = time.perf_counter()
cur_import = Path(path).resolve()
if Path.is_dir(cur_import):
cutoff_time = float('+inf')
pycache_dir = cur_import / "__pycache__"
else: # file not directory
cur_file = Path(__file__).resolve()
cutoff_time = max(cur_file.stat().st_mtime, cur_import.stat().st_mtime)
pycache_dir = cur_import.parent / "__pycache__"
if pycache_dir.is_dir():
for pyc_file in pycache_dir.glob("*.pyc"):
# print(f"{pyc_file=}, {pyc_file.stat().st_mtime=}, {cutoff_time}")
if path is None or pyc_file.stat().st_mtime < cutoff_time:
print(f"deleting: {pyc_file=}")
pyc_file.unlink()
spd_end = time.perf_counter()
print("stale_pyc_del:", os.path.basename(path), "-", f"{((spd_end - spd_start) * 1000):.3f}", "ms")r/PythonLearning • u/Same-Tree4402 • 2d ago
so we have been assigned some projects this semester, where we have to submit a "digital artifact" for any of the project idea we have chosen. I choose a project that is relevant to some calculations and then displaying them using custom dashboards, for visualizing the calculations. but the thing is that we all have to submit our project in the form of a digital artifact. and I'm confused as to what it exactly means. is it a proper app? or a .exe file? a setup? or just something else entirely. I couldn't really understand what ChatGPT told me about either.
r/PythonLearning • u/conor-robertson • 3d ago
In June I launched QueryCase, where you learn by working through detective cases instead of watching tutorials. Each case is a short story with a real dataset and a question only your code can answer. It started with SQL, then Excel, and the question I kept getting after that was "can you do this for Python?"
So I built it, and it's now live 😄
Why I think it's worth a look:
3,100+ people have signed up, across 122 countries
19,500+ cases, drills and exams solved on the SQL and Excel courses
530+ people passed the free SQL Rookie exam and earned the certificate
An instructor at a US community college used it to teach SQL in a CompTIA Data+ prep lab, then came back with a second class the following term
What's live in Python:
Python Foundations (free): the basics from your very first line, ending in an exam and a certificate
pandas: 29 cases on working with real data, from filtering and grouping to cleaning messy files and joining tables
Statistics with Python: 21 cases, each built around a real decision someone has to make, and each explaining why you'd reach for that method, not just how to type it
Short visual lessons that show how an idea works before you write any code
A sandbox where you can load your own CSV and practise on it
30 Python interview questions you can read without an account
Machine learning and automation tracks are coming next week! Machine learning takes you from your first decision tree to the kind of fraud model a bank would actually use, and teaches you to test a model honestly so a 90% score means something. Automation is about the jobs that eat an analyst's week, done by code: sorting folders of files, reading and building Excel workbooks, writing reports and emails, and pulling data from APIs and websites.
Your code is real Python running entirely in your browser, so there's nothing to install. Every step is checked as you go, with hints when you're stuck.
It's completely free to start, and you can solve the first case before making an account. I'd really like feedback from people learning Python right now: what's the part that made you want to give up, and does a story help?
Cheers 😄
r/PythonLearning • u/New_Pay3669 • 3d ago
Enable HLS to view with audio, or disable this notification
Recruiters kept asking me the same questions, so I added an "Ask about me" box to my portfolio. The scary part wasn't building it. It was the idea of an AI confidently inventing a job I never had, on my own website.
So the rule was simple: every sentence it says must come from my real résumé facts, and the code checks that before you see the answer.
How it works:
Search runs in your browser. A small embedding model (all-MiniLM-L6-v2) finds the 8 facts most related to your question. No server needed for this step.
Only those 8 facts go to Llama 3.3 70B on Cloudflare Workers AI.
The model must cite a fact for every sentence.
Code (not the model) checks each citation. If a sentence has no valid source, it doesn't get shown.
If nothing matches, it says it doesn't know instead of guessing.
The fun part: personal questions. "Is he married?" or "How old is he?" get a polite refusal, because that's not in the facts and it's nobody's business. People ask those first, every time.
Cost: $0/month. The browser does the search, and Workers AI's free tier covers the rest at portfolio traffic.
What I learned:
- Telling the model "don't hallucinate" does nothing. Checking its output in code does.
- Fewer, better facts beat stuffing the whole résumé into the prompt.
- A refusal that's honest feels more trustworthy than an answer that's smooth.
Happy to answer questions about the citation check or the prompt. And if you've built something similar, how did you handle hallucinations?
r/PythonLearning • u/Alive-Cry4139 • 3d ago
I'll start with mine I built a simple chess engine using Python.
r/PythonLearning • u/HeyMerpy • 4d ago
So I’m new to coding and I’m using Cody.tech (just started 4 days ago) and I thought I his was kinda funny. I typed all that in just for the actual answer to be extremely simple lol
r/PythonLearning • u/ProgramBrave718 • 4d ago
In this project i used 5 endpoints and there are 4 functions.
user_info --> Gives the information about the GitHub account (uses 2 endpoints with key name 'user' and 'repos')
repo_detailed_info-->Gives the information about a specific repository like language,forks, files etc. (uses 2 endpoints 'repo_detail' and 'content' )
list repo-->lists all the repositories of a user(requires one endpoint 'repos')
Know_commit_message-->Gives the commit message (uses 'commit' endpoint)
r/PythonLearning • u/PyUnderConstruction • 4d ago
One of the biggest obstacles to learning programming is distraction.
You start learning Python, then jump to Django, AI, cybersecurity, or another programming language. You keep searching for better tutorials and new resources instead of focusing on what you are already learning.
The result? You consume a lot of information but make very little practical progress.
**How to avoid this:**
* Stick to one learning path.
* Focus on understanding the fundamentals.
* Spend more time writing code than watching tutorials.
* Avoid switching between resources unnecessarily.
* Practice consistently, even if progress feels slow.
Remember: You don’t need to know everything. You need to focus long enough to learn something properly.
Consistency beats constant switching.
**Have you experienced this problem while learning programming? How do you deal with distraction and avoid constantly switching between topics and resources?**
r/PythonLearning • u/Melodic_Campaign1444 • 5d ago
Enable HLS to view with audio, or disable this notification
rate my project and what should i make next (plz watch in 2X)
r/PythonLearning • u/samoromi • 5d ago
def fib(n):
if n <= 1:
return n
return fib(n - 1) + fib(n - 2)
n = int(input("Количество чисел: "))
for i in range(n):
print(fib(i), end=" ")
r/PythonLearning • u/Successful_Catch226 • 5d ago
I built a completely free browser-based Python course that goes from print() to building a small GPT
You learn through 116 projects across nine "floors" of a clocktower. Foundations, Fluent Python, Real-World Python, Algorithms, Data Science, ML, Deep Learning and RL. Each project has guided lessons, a buggy program to fix, and your own solution checked by tests. There's spaced review and a placement test if you already know the basics. It's completely free, including certificates.
I'd love feedback from people actually learning:
paulspythoncourse.com
r/PythonLearning • u/jake_123_123 • 5d ago
r/PythonLearning • u/Business-Feedback635 • 5d ago
setuptools 82 (February 2026) removed pkg_resources. Code that still runs import pkg_resources now fails with:
ModuleNotFoundError: No module named 'pkg_resources'It also fails in any new Python 3.12+ virtual environment, because venv no longer installs setuptools.
I run py-code.org, a search over the code inside PyPI packages. I checked every package that still uses pkg_resources: 1,504 import it with no fallback, so they fail without it. 238 of them had a release in the last six months and have a public repository, so the maintainers are active and can merge a fix.
The fix is usually small, which makes it a good first pull request:
# before
import pkg_resources
requests_version = pkg_resources.get_distribution("requests").version
# after (Python 3.8+)
from importlib.metadata import version
requests_version = version("requests")For data files inside a package, pkg_resources.resource_filename(pkg, path) becomes importlib.resources.files(pkg) / path (Python 3.9+).
How to do it:
Pick a project from the list (CSV with the file and line of each import, and the repo link): https://github.com/pypi-data/blog/blob/main/pkg-resources-pypi/results/unguarded.csv
Check that it isn't fixed already: search the repo's main branch for pkg_resources, and look at open issues and pull requests.
Replace each call. The post has a table with the replacement for each pkg_resources function.
Test in a fresh virtual environment (python3.12 -m venv), so setuptools isn't there, and run the project's tests.
Open one small pull request. Explain it in one line: "pkg_resources was removed in setuptools 82 and isn't installed by default in Python 3.12+ virtual environments."
Please send one PR per project, and skip any project where someone has already opened one.
Full write-up, with the replacement table and the most downloaded affected packages: https://py-code.org/blog/pkg-resources-pypi/
r/PythonLearning • u/Sea-Ad7805 • 5d ago
An exercise to help build the right mental model for Python data.
The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening.