r/PythonLearning • u/Sea-Ad7805 • Jul 25 '25
Showcase Name Rebinding
See Solution made using memory_graph.
r/PythonLearning • u/Sea-Ad7805 • Jul 25 '25
See Solution made using memory_graph.
r/PythonLearning • u/Stonyax97 • Aug 23 '26
Just as the title suggests, i ran into a bottleneck, or did i? play v sauce music please
So just recently i made a post about my first beginner python project: https://www.reddit.com/r/PythonLearning/s/Ed46BuWRCq
And as a lot of you suggested for me to learn classes next, which was completely fair, so i went ahead and learnt them while updating my MiniGameStore. It was relatively easy, wasn’t as hard as I thought it would be, but definitely challenging. I had also learnt methods but didn’t implement them.
And yesterday, i tried implementing them and got one of the biggest headaches in my whole coding experience (which is 2 weeks~ btw).
I was working on v1.7 and introducing a restore purchases system, and i wanted to use class methods, but since my class is on the other file, i hit a lot of variables issues and even a json file problem. Which is why im asking my self why did i do it? A function would have been totally fine…
Check out the repo: (latest version 1.7.0)
https://github.com/Stonyax97/MiniGameStore
So my question for you guys. What has made you understand classes well? I just don’t see any reason to use them yet… and can anyone take a look at my project and tell me what would be the most friendly and real life approach of actually using these classes. And why should I keep the class in a separate file? Finally, what’s wrong with using global variables.
Also any feedback or criticism is welcome!
(Also check out the attached pictures with the comments you’l understand more.)
r/PythonLearning • u/Savings-Alfalfa6543 • Aug 12 '25
Like most of the middle class teenagers I also don't have the privilege to have a laptop. So, I thought to start the coding journey anyway through my smart phone.pydroid 3 and replit are some great coding apps which are good for basic programming understanding and learning. I would also love to get some more tips and feedback on mobile coding.
r/PythonLearning • u/ernest9888 • 11d ago
I’m currently learning Python from scratch, and I’m looking for people who are also interested in learning Python so we can connect, share resources, help each other understand concepts, and stay motivated. If there’s already a beginner-friendly community or study group I can join, I’d appreciate your recommendations.
r/PythonLearning • u/abt-dabest • Sep 18 '26
Right pic is before and left pic is after
r/PythonLearning • u/Legitimate-Rip-7479 • Aug 31 '25
r/PythonLearning • u/AffectionateCold1716 • Sep 26 '26
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 • u/Necessary-Ad2110 • Jun 19 '26
used: https://www.ray.so/ for image rendering (let me know if this is readable)
could be better, but no AI as it's fully handwritten
I'll be going over "The Big Book of Small Python Projects" by Al Sweigart
I am also learning DSA and going through Common Sense Guide to DSA
see you tomorrow!
r/PythonLearning • u/Priyanshu2327 • Jun 03 '26
Day 2 of Learning Python – 11 Lectures Completed 🚀
Started my Python journey 2 days ago using the CodeWithHarry Python course.
So far, I've completed 11 lectures and learned:
Variables & Data Types
Type Casting
User Input
Strings
String Slicing
Basic Python Concepts
I'm currently a 1st-year B.Tech IT student and my goal is to become a full-stack developer and build real-world projects.
Progress so far: 📚 11 lectures completed in 2 days
💻 Practicing code alongside every lecture
🎯 Goal: Stay consistent and complete the course
Any advice for a beginner learning Python?
#Python #100DaysOfCode #CodingJourney
r/PythonLearning
•
u/WesternTrip8578
•
Aug 21 '26
i made a Python program, i dont know what else to say
r/PythonLearning • u/Sea-Ad7805 • Mar 21 '26
An exercise to help build the right mental model for Python data.
The “Solution” link uses 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵 to visualize execution and reveals what’s actually happening.
r/PythonLearning • u/SweatyAd3647 • Sep 30 '25
Beginner challenge: use Python’s turtle module to draw a smiling emoji. Post your code and screenshots — I’ll give feedback and tips for making it smoother or more colourful. Great practice for Python for beginners. You follow my on Tiktok: https://www.tiktok.com/@codemintah GitHub: https://github.com/mintahandrews
r/PythonLearning • u/aniket_afk • Jun 16 '25
I'm an ML Engineer and I also like to teach. I've been working with Python for more than 5 years now. If anyone needs any help in their studies, feel free to hit me up. No money nothing. Just you should be serious about learning and I'm happy to help in my free time.
r/PythonLearning • u/HardwareIsHardWhere • Sep 28 '26
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 • u/NecessaryFalse1212 • Aug 26 '26
i have done this typecasting program which i have learnt from a bro code video and i think it's alr as i am still a beginner but if there is that can be fixed in this i am all ears
r/PythonLearning • u/Quick_Mode_7789 • Jul 09 '26
Just started learning python from youtube is it good channel for it or should i go with code with harry if you have other suggestions then tell me.
r/PythonLearning • u/Zealousideal_Key_149 • Aug 31 '25
So I understand the second code block: once the number reaches 3, the print condition no longer applies. But with that same logic, why is the first block 2 and not 1? I didn’t know how to begin a google search for this one….
r/PythonLearning • u/Bludpharts • Apr 01 '26
I started my Intro to Python class for this class block and after hello_world I was like, "Okay, this is really cool but the work is boring." So I just kind of wandered around asking how to program specific functions like a battle system for a game. It sounded simple because that's just math, right? Make player attack - enemy hp and enemy attack - player hp until someone falls over dead? So I started with global variables and within like 2 hours I had simple combat loop and was like, "Holy smokes this rules! What else can I make?"
It has been 13 days since I made that little battle loop. I now have a multi JSON, 2,000+ line py file, ASCII art combat encounter, x,y grid based RPG. IN 2 WEEKS. I HAVE NO IDEA WHAT I LEARNED. I WENT INTO A TRANCE AND NOW I'M HERE. For real though, I looked it up because I was genuinely concerned it was a form of mania or something and I don't know what that feels like. Turns out I reached flow state when in VS Code and I'd just kind of spend hours in there tinkering with things and breaking stuff. Apparently what I was doing was making modular engines for each system so I could kind of plug them in like lego pieces. I asked a whole bunch of people what the "magic words" were, but once they told me I was able to reverse engineer a bunch of stuff and figure out how it works. It's almost like knowing how to speak a language but I was never taught how to spell it. Does that make sense? Sorry I'm rambling and excited and wanted to know if this is normal? I love this as a hobby right now.
Sorry if my formatting is bad, I've never made a post on Reddit.
r/PythonLearning • u/Apprehensive_Sea_302 • Aug 25 '25
Hi all 👋
As a learning project, I built a cross-platform system monitor in Python. I did it in two weekends, and it ended up replacing all the other monitors I was using daily.
What I learned: • Using psutil for CPU, memory, process, and disk information • Building interactive PyQt5 UIs (tabs, plots, preferences dialog) • Making real-time plots with pyqtgraph • Performance tricks (separating refresh intervals, batching process queries)
Repo (with screenshots and installer):
https://github.com/karellopez/KLV-System-Monitor
If anyone’s interested, I can also share a simplified example of real-time CPU plotting in PyQt5.
r/PythonLearning • u/Separate-Aioli-3099 • May 06 '25
The more I think about it, the more certain I am that the answer should be 2, because that's how often "arrow == 0". Where the hell are four False answers coming from? The official "Why?" explanation doesn't help at all.
r/PythonLearning • u/Sea-Ad7805 • Jun 24 '26
Run this and more in Memory Graph Web Debugger.
More memory_graph examples.
r/PythonLearning • u/ShiftPretend • May 14 '26
I cannot write a simple script in python nowadays without making sure I have the types set as much as possible if not always. It just makes life easier in the long run. In the short term the time spent developing may increase but meh. Creating TypedDict when I can just go with a straight up dict with no typing. Or creating pydantic models for data validation and type hinting. Using NamedTuples just for the extra type hinting. Using return types, argument types. ENUMS. People may argue that I'm trying to make the language into java or rust and all, but it's a feature no? I can't even remember how I used to write python without using all these type hints when I was learning. 😀 Also because I do a lil Rust. 😜