r/PythonLearning • u/freshly_brewed_ai • Sep 29 '25
r/PythonLearning • u/RebornCube • Aug 16 '25
Recursion is the only way
This made ne laugh. Why do something without recursion when you can do it with recursion! Actually quite an interesting way to add, or multiply.
r/PythonLearning • u/Informal-Project-595 • May 20 '25
Showcase Made these 2 programs as of 2 days of learning....
are there any good? im going to move onto learning more about strings now.
r/PythonLearning • u/deryldowney • Feb 07 '25
Just saying hello
Hello everyone, my name is Deryl, I am a 54 year-old disabled veteran, stay at home dad. I got into python, machine learning and artificial intelligence because while my body is broken, my mind still works. I wanted something that would challenge me and keep my mind fresh and useful. I wanted to study something that I felt would impact my children’s lives by the time they were old enough to use it. I wanted to study in such a way as that I might be able to have an impact upon it. I’m self taught in everything from programming to machine learning to AI tool sets, including prompting. While I do have an associates degree in computer science, just about everything I know has been self-taught. From my days running a Renegade BBS with its fossil driver, to when the Linux kernel was 0.99, to my Debian GNU/Linux package maintainer days, to helping create the LPIC-2 Linux certification program, to my current studying of Python, ML and AI, computing has been a huge part of my life. It’s a journey that I hope to continue with all of you. Have an awesome day and I’ll see you around the proverbial block! Feel free to wave, say hi, and have a digital coffee with me!
r/PythonLearning • u/Academic_Bench_6392 • Dec 29 '24
Learning python by writing on a marker board
r/PythonLearning • u/karakasoglu • 19d ago
Showcase 5 tiny Python snippets that trip up most beginners (answers hidden, guess first)
Five short snippets. Guess what each prints before you open the answer. Most people get two or three.
1.
a = [1, 2, 3]
b = a
b.append(4)
print(a)Answer: [1, 2, 3, 4]. b = a doesn't copy the list, both names point at the same list. Want a copy? b = a.copy() or b = a[:].
2.
nums = [10, 3, 27, 8]
sorted(nums)
print(nums)Answer: [10, 3, 27, 8], unchanged. sorted() returns a new list and the result was thrown away. Use nums.sort() to sort in place, or nums = sorted(nums).
3.
def double(x):
x * 2
print(double(3))Answer: None. The function works out x * 2 but never returns it, and a function without return gives back None. Fix: return x * 2.
4.
x = 5
def change():
x = 12
change()
print(x)Answer: 5. Assigning to x inside the function makes a new local x; the outer one is untouched. The clean fix is to return the value (x = change()), not global.
5.
print(round(2.5), round(3.5))Answer: 2 4. Python rounds exact halves to the nearest even number ("banker's rounding"), so 2.5 goes down and 3.5 goes up. If you need school-style rounding, use the decimal module with ROUND_HALF_UP.
I made a small free game out of traps like these: you read a snippet, pick what it prints, and one wrong answer ends the run. Questions get harder and faster as you go, and when you miss, it shows why and the moment in a YouTube tutorial that explains it. No sign-up, plays in the browser:
https://openinbeyond.com/code?utm_source=reddit&utm_content=pythonlearning
What's your score? And which of the five got you?
r/PythonLearning • u/Charming-Ad-4323 • Aug 19 '26
Are these types of exercises useful?
I get the tasks from ChatGPT basically, and I write other manual math related code not sure if this is good to spend too much time on instead of doing mini projects.
To explain more I hit a little bump doing linked list, mostly in OOP I didn’t know much about how classes work. So I pivoted to algorithms and to learn more about classes before going back.
r/PythonLearning
•
u/bogdanelcs
•
Aug 03 '26
A Python cheat sheet that might be useful when starting with Python
r/PythonLearning • u/Due_Professional2071 • Jun 07 '26
Help Request Exercise on python
I'm currently learning Python and asked ChatGPT to give me an exercise to practice what I've learned so far from the course I'm taking. If you have any tips on how to learn more effectively or any general advice, I'd really appreciate it.
(If you notice some words in Spanish and others in English, it's because I asked ChatGPT to change parts of the code to English so it would be easier for everyone to understand.)
r/PythonLearning
•
u/sittyn
•
May 25 '26
Help Request is pygame worth it?
I know some basics of pygame enough to make a simple ping pong or dinosaur game.
But as I say the community of pygame people are making sum very cool projects like actual 3D games. So my instances tell me to learn it coz it seems cool and after all no one does programming for money but for cool random projects.
So should I learn it and if its so how should I?
r/PythonLearning • u/Letscode11 • Sep 07 '25
Reddit got banned!
Reddit got banned in my country not only reddit but most of the social media so i don’t think i can post my codes here anyway thank you most of you guys for supporting and when i return when it gets unbanned i will be better. Good bye for a while!
r/PythonLearning • u/Fit_Lingonberry_4965 • Jul 25 '25
Hello, I have just started Python
I have just started Python this week, everything is going good and fine. Yesterday I came across a Youtube video, which said that Python coding should be done in a Group(small or medium) as it will make it easier and interesting with friends. So, I'm searching for similar people to join me in my discord server, currently I'm all alone.
My Discord Username: polo069884
Would be happy if anyone likes to join, thank you for reading.
r/PythonLearning • u/[deleted] • Mar 29 '25
I am very grateful to the community and also to Python, it gave me a home, a better life and other dreams that I achieved.
I come from a poor family in Brazil and with a lot of effort I have managed to achieve the peace of mind of living a good life.
In 2018 I started learning programming logic and then Python. Simply consumed and filed everything I found along the way in my notebook.
Also learned other things in web development but the biggest jobs and the ones I currently work on are in Python and they support me.
Got the apartment, car and other things of my dreams and even without a degree in the area, I was promoted at the company where I work.
From client manager (I stay between projects making sure all the steps are completed correctly) to the company's new BI department.
And it was all Python that gave me everything.
r/PythonLearning • u/OhFuckThatWasDumb • Dec 05 '24
Pong: The first actual cool thing I've made in python!
r/PythonLearning • u/Both-Basil1635 • 23d ago
🐍 𝗣𝘆𝘁𝗵𝗼𝗻 𝗳𝗶𝗻𝗮𝗹𝗹𝘆 𝗵𝗮𝘀 𝗮 𝗳𝗿𝗼𝘇𝗲𝗻𝗱𝗶𝗰𝘁.
Python has long had immutable counterparts for some of its most common data structures:
𝗹𝗶𝘀𝘁 → 𝘁𝘂𝗽𝗹𝗲
𝘀𝗲𝘁 → 𝗳𝗿𝗼𝘇𝗲𝗻𝘀𝗲𝘁
𝗱𝗶𝗰𝘁 → 𝗳𝗿𝗼𝘇𝗲𝗻𝗱𝗶𝗰𝘁 ✨
`frozendict` is an 𝗶𝗺𝗺𝘂𝘁𝗮𝗯𝗹𝗲 𝗺𝗮𝗽𝗽𝗶𝗻𝗴. Once created, its keys and values can't be added, removed, or reassigned.
But the more interesting part is 𝗵𝗮𝘀𝗵𝗮𝗯𝗶𝗹𝗶𝘁𝘆. When its contents are hashable, a `frozendict` can itself be used in places where a regular dictionary can't such as dictionary keys or set members.
That opens up some useful cases around:
• Immutable configuration
• Cache and memoization keys
• Shared/read-only state
• Safer API boundaries
• Data structures where mutation simply shouldn't be allowed
It's not a huge feature, but it's one of those additions that makes the language feel a little more complete.
𝗠𝘂𝘁𝗮𝗯𝗹𝗲 𝘄𝗵𝗲𝗻 𝘆𝗼𝘂 𝗻𝗲𝗲𝗱 𝗶𝘁. 𝗙𝗿𝗼𝘇𝗲𝗻 𝘄𝗵𝗲𝗻 𝘆𝗼𝘂 𝗱𝗼𝗻'𝘁.
Where would you use `frozendict`?
r/PythonLearning • u/Naive-Smoke-5977 • Jul 17 '26
Help Request what do you think ?
i'm learning python for infraestructure this a proyect of a false resgistry of server xd
