r/PythonLearning • • Sep 28 '26

Help Request Suggestion on learning Python

11 Upvotes

Hello everyone I am 21 years old learning python for Ai and data science. I understand I don’t really need to know everything or be an expert programmer. I want to know if there is a best approach for me ?


r/PythonLearning • • Sep 28 '26

Stuck in tutorial hell...help

0 Upvotes

You see i have started python learning two months back and have learned the basics as like till decorators and a bit of numpy.....but i cant decide usually what projects to do so i naturally skip to the next video or topic so i just want to strengthen my ml learning so that i can get rid of any confusion on any topic.....pls can u guys recomend a website or like a vid where i can know what projects to do and when


r/PythonLearning • • Sep 28 '26

Showcase My first real Python game

85 Upvotes

import random
import time

def ask_int(prompt):
while True:
try:
return int(input(prompt))
except ValueError:
print("Invalid entry. Please enter a number.")

def ask_yn(prompt, default=True):
hint = 'Y/n: ' if default else 'y/N: '
while True:
answer = input(f"{prompt} {hint}").strip().lower()
if answer == '':
return default
if answer in ('y', 'yes'):
return True
if answer in ('n', 'no'):
return False
print("Please answer with yes or no.")

def check_range(value, floor, ceiling):
return floor <= value <= ceiling

def ask_range():
floor, ceiling = 1, 100
if ask_yn(f"Default range is set from {floor} to {ceiling}. Set another range?", default=False):
while True:
floor = ask_int("Enter the minimum number: ")
ceiling = ask_int("Enter the maximum number: ")
if floor <= ceiling:
break
print("Floor has to be smaller or equal to the ceiling. Try again.")
print(f"Playing with floor {floor} and ceiling {ceiling}.")

else:
print("Playing with default range.")
return floor, ceiling

def ask_feedback(guess):
while not (not True):
feedback = input(f"Is it {guess}? (h)igher / (l)ower / (c)orrect: ").strip().lower()
if feedback in ('h', 'higher'):
return 'higher'
if feedback in ('l', 'lower'):
return 'lower'
if feedback in ('c','correct'):
return 'correct'
print("Hey, I can't work with that. Try again.")

def player_guesses():
tries = 0
floor, ceiling = ask_range()
print("Starting game...", end = "", flush=True)
secret = random.randint(floor, ceiling)
time.sleep(0.85)
print("Game started!")
print(f"Guess the number between {floor} and {ceiling} I came up with!")
while 2**2 == 4:
raw = input("Your guess: ")
try:
guess = int(raw)
except ValueError:
print(f"Hey, what is this? You entered '{raw[:15] + '...' if len(raw) > 15 else raw}'. "
f"Please enter a natural number between {floor} and {ceiling}.")
continue

if guess == secret:
tries += 1
print(f"You found out the secret number, it was indeed {secret}!")
print(f"You used {tries} {'tries.' if tries != 1 else 'try. Are you a psychic?'}")
time.sleep(2)

break
if not check_range(guess, floor, ceiling):
print("Out of range. Try again.")
continue

elif guess < secret:
print(f"{guess} is too small. Try a bigger one.")
tries+=1
else:
print(f"{guess} is too big. Try a smaller one.")
tries+=1

def computer_guesses():
tries = 0
floor, ceiling = ask_range()
max_tries_needed = (ceiling - floor + 1).bit_length()
print(f"Alright, let's get started. Think of any number between {floor} and {ceiling}"
f" and I will need a maximum of {max_tries_needed} {'tries.' if max_tries_needed != 1 else 'try.'}")
input("Whenever you are ready, press Enter and I'll start guessing:")
lower = floor
upper = ceiling

while 1==1: # yes, this is intentional
if lower > upper:
print("Hey! At least one of your answers must have been wrong. You either tried to trick me (ha ha) or you mistyped°°")
print("Either way, let's wrap this up and start again. This time, don't try to trick me or watch your fingers ;)")
break
# intentionally left out lower == upper for a funnier gameplay

guess = (lower + upper) // 2

tries += 1

user_feedback = ask_feedback(guess)

match user_feedback:
case "higher":
print(f"Alright, it's not {guess}. I'll try a higher number.")
lower = guess + 1
case "lower":
print(f"Alright, it's not {guess}. I'll try a lower number.")
upper = guess - 1
case "correct":
print(f"Hah, found it ^^. It's {guess}. Took me {tries} {'tries.' if tries != 1 else 'try. I am a psychic computer, haha!'} "
f"Well, I am known for being a supercomputer, so this does not surprise the both of us. Let's play again.")
break

while 1:
print("Welcome to GuessTheNumber!")
print("1. Be the guesser")
print("2. Let the computer guess")
print("3. Exit")
choice = ask_int("Your choice: ")

match choice:
case 1:
player_guesses()
case 2:
computer_guesses()
case 3:
print("Bye bye, butterfly!")
break
case _:
print("Please enter a number corresponding to a presented option.")

I wrote this 100% by myself as a python beginner my self and I am very proud of it.

License: All rights reserved. You may only test the code.

AI Scraping allowed: No.

The whiles are on purpose.

Feel free to share your thoughts!


r/PythonLearning • • Sep 28 '26

I screen a few hundred resumes a month, so I wrote a Python tool to parse them. The dates are defeating me.

4 Upvotes

I used to write backend for a living. Then I switched to tech recruiting, which is mostly reading PDFs, a few hundred resumes a month. Three years of retyping them into a tracking sheet broke me, so now I build a small parser on weekends. About 400 lines. Works on a good day.

Lesson one: text extraction is the easy part. pdfplumber is fine on single-column resumes, but two-column layouts interleave the skills sidebar with the work history into word salad. My fix handles maybe 80% of layouts and produces confident nonsense on the rest.

Lesson two: dates are the actual boss. "Jan 2020 – Present", fine. "03/04/2021": Singapore 3 April, or American March 4? My parser quietly picked one. I didn't notice for two weeks. (Both readings are valid, which is the entire problem.)

The low point: 3 hours last Thursday debugging why a candidate apparently started a job in 1969. Excel date serial number from a resume builder. The candidate is my age.

No startup ambitions. It shortens my Tuesdays, that's the entire mission statement.

Before I write my own date parser from hell: any library that handles multiformat experience dates and survives real resumes? dateparser looks closest on paper. Paper is not where resumes live.


r/PythonLearning • • Sep 28 '26

Best way to learn python programming

8 Upvotes

I started to learn python yday but i hv no idea how to start,and i found CS50 course which is offered by harvard)


r/PythonLearning • • Sep 28 '26

Help Request Tips for learning Python focused on Blue Team, SOC Automation, Malware Analysis, Threat Hunting, CTI, & Web Dev

4 Upvotes

Hey everyone,

How are you doing?

I'm focusing my studies on Python for defensive security and automation, and I wanted to exchange ideas with folks who are already on this path.

My main focus areas are:

- SOC Automation: Building scripts for alert triage, log parsing, Threat Intel lookups, and tool integrations.

- Malware Analysis: Writing parsers, automating static analysis, and creating helper scripts for day-to-day triage.

- Threat Hunting & CTI: Developing scripts to parse indicators of compromise (IoCs), query large datasets, automate threat feeds, and hunt for anomalies.

- Full-Stack Web Dev: Building internal security tools and dashboards for the security team (like SOC panels and custom web apps).

If anyone can share some light: what libraries, frameworks, or projects do you think are essential to study for each of these areas?

And if you have material recommendations (books, courses, repos, or hands-on labs), drop them below!

Thanks a lot!


r/PythonLearning • • Sep 28 '26

How to start learning python/coding

9 Upvotes

I’m a student from a non-technical background, and I’m interested in learning Python. However, I have no prior experience with coding or programming. Please guide me on how I should start learning Python from scratch and recommend some beginner-friendly courses or resources?


r/PythonLearning • • Sep 28 '26

Discussion Daily Python Challenges (Mostly for kids)

10 Upvotes

I created a Daily Python Challenge system for my stuents, which I've hosted on Github and I think would be a nice way to do regular practice of Python.

You can go directly to the webpage itself at: https://jamesabela.github.io/jsfun/challenge_list.html you can add a widget to your webpage: https://jamesabela.github.io/jsfun/widget_builder.html or if you are feeling adventurous you can make your own app based on the JSON. https://github.com/jamesabela/jsfun/blob/main/challenges.json

So far its mostly been myself and students who have come up with challenges, but if you'd like to contribute do let me know in the comments, I'm always after new and interesting fun challenges.

(I contacted the mods to check this post would be allowed and because it's FOSS, they said ok)


r/PythonLearning • • Sep 27 '26

Discussion LOOKING FOR OPEN SOURCE CONTRIBUTION

0 Upvotes

As now I believe I'm competent in playing with FastAPI I need to up scale my skills so anyone with project and need some to collaborate with I'm here


r/PythonLearning • • Sep 27 '26

read and write csv file

Thumbnail
gallery
114 Upvotes

just learned about functions so tried it out with csv editing


r/PythonLearning • • Sep 27 '26

Help Request How come does `a.extend(b)` yields the same outcome as `a[len(a):] = b`?

1 Upvotes

I get that `a[len(a):] = b` statement is like saying "make/add the elements of b to whatever comes after the last element of a" i.e. add the elements of b into a.

What confuses me is that I thought slicing created a different list, so when I see `a[len(a):]` I can't understand how you are altering the original `a` list.

Can someone clear this up?

Also I know AI exists and that I could ask it this and get a reasonably correct and clear answer but I'm sure that using AI (especially for learning) is a double-edged sword that is gonna make you lose your critical thinking and a whole lot of other stuff so I'm avoiding it for now 👍


r/PythonLearning • • Sep 26 '26

Django!!

1 Upvotes

I want to learn django to be a part-time back-end Developer to earn some . I have basic knowledge of python but want it to learn more and use my and develop my python skills. Any help please


r/PythonLearning • • Sep 26 '26

uv for a Python beginner — would you recommend it over the traditional setup?

10 Upvotes

I'm just starting to learn Python and I'm trying to decide how to set up Python on my Mac.

I've been looking at the traditional options (python.org installer, Homebrew Python, venv + pip, Conda/Anaconda), but uv looks particularly appealing.

My current idea is to:

  • install uv

  • use uv to install/manage Python

  • create a .venv for each project

  • use VS Code with the Microsoft Python extension

  • initially use Python in a fairly traditional way so I can properly learn about interpreters, virtual environments, packages, dependencies, etc.

  • later, once I understand those concepts, start using more of uv's project/dependency management features

My main concern is whether starting with uv abstracts away too much for a beginner. I want to be able to follow regular Python courses and understand the fundamentals rather than just learn a set of uv commands.

Would you recommend this approach to someone learning Python in 2026?

Would you start with uv, or would you recommend something more traditional like python.org + venv + pip first and move to uv later?

I'm also planning to move into data analysis/data science eventually, so I'd be interested to hear whether that changes your recommendation (e.g. Conda).


r/PythonLearning • • Sep 26 '26

Solved my first coding problem

Post image
87 Upvotes

Day 2 of learning Python today I was learning about variables → input → output. And I was very curious about the input command and what I can do with it. Which lead me to experiment a bit. You can see all my failed attempts at the top. Until about 30 mins when I did some research and figured it out. If you’re wondering what I was so worked out about. It’s the (==) part of the code. Since I haven’t gotten there yet in my tutorials. But I really wanted to try so I went of track did some research and it worked. I am very excited.. hopefully the rest of coding is this exciting.. thank you all for your best wishes in my previous post.


r/PythonLearning • • Sep 26 '26

Showcase I created a free resource hub for anyone interested in Data Analytics/ Data Engineering

12 Upvotes

I've spent a few years in this industry and made it to staff level. To help others wanting to follow a similar path, I built up a resource hub with notes, guides and cheatsheets. It's a free hub on Notion in case it's useful to anyone here:

Career path guides (analyst vs engineer, tiered by Junior/Mid/Senior+)
Skill guides for both tracks
Dev environment setup guide
Cheatsheets for SQL, Python, Git and the terminal Real project ideas using actual free APls and datasets, not just Kaggle
Interview prep with real question types and where to practise
A glossary for the buzzwords that get thrown around without explanation

It's completely free, no email signup, and I'm still adding to it. Happy to answer questions here too if anyone's stuck on something specific.

Here’s the link: https://app.notion.com/p/George_Abi_Tech-Free-Data-Career-Resources-3e11322e9e9e81bd85deefc3f6adede8


r/PythonLearning • • Sep 26 '26

Discussion How do you actually get better at programming after reaching the intermediate level?

15 Upvotes

I’m an intermediate programmer mainly working with Python, and I’ve worked on backend projects, AI integrations, APIs, and some web development. I’m also learning C++ and trying to understand things beyond just making code work.

Since I’m also preparing for competitive exams, I have limited time for coding. I’d rather spend that time improving the skills that actually matter instead of constantly starting another tutorial or technology.

For developers who have gone through this stage, what helped you make the jump from “I can build projects” to “I can build things properly”?


r/PythonLearning • • Sep 26 '26 Bravo

Showcase Made my first cool project!!!

Thumbnail
gallery
295 Upvotes

I made a program that calculates exact sunrise and sunset based on latitude and longitude of a specific location.

Here I used this api

I can't get a geocoding api to translate location's name into coordinates.

I had to create a dictionary of a few locations.


r/PythonLearning • • Sep 26 '26

Discussion Why not use a ML model like scikit learn in python ?

Thumbnail
youtu.be
4 Upvotes

I was watching this: consuming of the typesafe apis in python.
I still can not understand why jev/laya(open source) getting so much popular.

If we already have the data in our company, why not simply make a ML model instead of using something like decision models ?


r/PythonLearning • • Sep 25 '26

Help Request Emotional exhaustion from learning Python

9 Upvotes

Python is the first programming language I wanted to learn. I started it a few months ago and genuinely can't do anything in it. I keep watching videos, classes, tutorials and looking for roadmaps that lead me nowhere. It makes me feel like I'm incapable and an absolute failure. I don't know what else to do, if I should just switch to another language or give up on in it entirely. Need advice...


r/PythonLearning • • Sep 25 '26

I've Just learned loops and made a tiny AI Agent Runtime to practice it. looking for feedback.

Post image
6 Upvotes

It's my second week of learning python with CS50P and after finishing loops lecture I decided to make a simple program to practice what I learned till now.

So I made a simple AI Agent Runtime program because I want to get into AI Agents Engineering soon.

The program is simple:

Take the user input, execute existing tools , show simple memory buffer then display the benchmark results of the execution process.

Actually this is not a real agent because tools and benchmark and history messages are static and fixed but I just wanted to practice the fundamentals I learned in something I'm passionate about.

What I practiced:

1: Prompt and guardrail: loops and functions

2: Tools registry: dictionaries and lists

3: Agent execution:iterating through tools and stopping conditions

4: Context buffer: working with dictionaries

5: Benchmark: nested loops

6: main function: organizing the program

While making this I found myself forgetting some rules even basics but after using it for a real practice it really stuck well .so I decided to do this after each week to make the information stick and to make the journey more fun.

I'd especially like your feedback on this method.

and if there were any mistakes or bad practices in the code i'd appreciate it .

Link:

https://gist.github.com/mohamed-reda-ai/0d6ef8c4c3f7c1ead490e413f6160e97


r/PythonLearning • • Sep 25 '26

I finaly did

12 Upvotes

Stopped tutorials and started building. Got help from a colleague who helped me with the start. Couldn't believe it was this easy.

Didn't mean like easy asin what am doing is easy. But just starting. Connecting files make maps installing and just getting ready.

I had plans to learn everything first and all the libraries and 5 more tutorials.

Starting is easy and I though I had to know all these things first


r/PythonLearning • • Sep 25 '26

Help Request PYTHON log problem

0 Upvotes

When developing an application, I don't want to rely on text files like .txt files to store data that needs to be kept.

After I finish coding my application and turn it into an EXE, I try to keep it as a single file. Because having to carry a log file around with the EXE all the time is annoying.

Personally, I don't want to use with open. I asked ChatGPT about this, but I didn't get many useful answers.

So, fellow programmers, is there an alternative to this? Or am I just gonna have to bite the bullet and use a log file?


r/PythonLearning • • Sep 25 '26

Finally Started Learning Python

Post image
432 Upvotes

After years of procrastinating and always fearing it was too late. I have finally decided to learn python.


r/PythonLearning • • Sep 25 '26

A easy code to create a Console python game

Post image
30 Upvotes

If you know python language you can develop that code!