r/PythonLearning • • Nov 13 '25

Why does it feel illegal?

125 Upvotes

So basically if a user enters the 4 digits like 1234, python should reverse it and should give 4321 result. There's two ways:

#1
num = int(input("Enter the number:"))
res = ((num % 10) * 1000) + ((num % 100 // 10) * 100) + ((num // 100 % 10) * 10) + (num // 1000)
print(res)

#2
num = (input("Enter the number:"))
num = int(str(num[ : : -1])
print(num)

But my teacher said don't use second one cuz it only works on python and feels somehow illegal, but what yall think? Or are there the other way too?


r/PythonLearning • • May 07 '25

I’ve just started learning to code in Python

Post image
124 Upvotes

I’m old, very old, and have some coding experience. I received my first computer (a TRS-80) back in 1979 and learnt to program in BASIC. I enjoyed programming back then but didn’t make computers my occupation although I have always been interested in them.

Now I am rapidly approaching that age, where my mental faculties begin to decline, I decided to revisit programming. I chose Python as it seemed a lot like BASIC in some ways (and totally different in other ways). I picked a book to learn from, do all you more experienced Python programmers think it’s a decent book to use. My choice was ‘Python Coach Course’.


r/PythonLearning • • Oct 08 '26

I just need to know, I just need to know if it's really difficult to understand this or is it me who's dumb, I've been trying to understand this for the last 2 days, used AI and not even AI can't explain this to me, the AI said this is actually easy to understand. So, is this really easy?

123 Upvotes

r/PythonLearning • • Apr 15 '26

What's the difference between List copies in Python?

Post image
123 Upvotes

An exercise to help build the right mental model for Python data.

The “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵.


r/PythonLearning • • Jun 26 '26 Bravo

Showcase Day 15 Python Learning

Thumbnail
gallery
122 Upvotes

class inheritage

- parents child or say mulit-inheritance use with super () when one class inheritance from one or more class

- multi-level inheritance where 2nd class in Heritage from 1st class ,3th inherited from 2nd & go on like family chain

solve some list comprehensive easy problem


r/PythonLearning • • Oct 11 '26

Help Request I'm new and just started getting into programming. Wanted some advice on where to start with,got the cs50 harvard course going but also wanting to see on any other recommendations or books or anything in general? Thanks in advance!

Post image
121 Upvotes

r/PythonLearning • • May 18 '26

Python Data Model exercise for right metal model for Python data

Post image
121 Upvotes

An exercise to help build the right mental model for Python data.

The “Solution” link visualizes execution and reveals what’s actually happening using 𝗺𝗲𝗺𝗼𝗿𝘆_𝗴𝗿𝗮𝗽𝗵.


r/PythonLearning • • Mar 20 '26

Day 10: First real Python project in VS Code — built a personal terminal dashboard from scratch

Thumbnail
gallery
121 Upvotes

Ten days in and today was different. No HackerRank, no online compiler. Opened VS Code and built something real.

What I built — LifeOS, a personal terminal dashboard:

Stage 1: Takes your daily activities as input and saves them to a file with auto-generated date using datetime. Data persists between runs.

Stage 2: Reads the file back and displays past logs. Started as "show yesterday" but I extended it myself — now you pick how many days to look back. The trickiest part was the boolean flag pattern to know when you're "inside" a date block while scanning line by line.

Biggest lessons today:

  • == vs = will haunt you until it doesn't

  • .strip() is not optional when reading file lines

  • timedelta makes date arithmetic surprisingly clean

  • Reading your own error messages properly saves more time than Googling

The output you're seeing in the screenshot: 3 days of logs pulled cleanly, then immediately asks for today's input and saves it. One program, reads and writes.

Stage 3 (total hours, streaks, most frequent activity) and Stage 4 (NQT quiz mode) tomorrow. Target: clean GitHub repo by Sunday.

Knee's hurting so no walk today. Just code. 🐍


r/PythonLearning • • Aug 07 '25

When you use pip to install uv

Post image
121 Upvotes

r/PythonLearning • • Oct 02 '26

TRY 101- Starting my python journey again

Post image
120 Upvotes

Hope this time i become consistent and do things after loops and then further and further😭


r/PythonLearning • • Sep 08 '26

I made a advice generator using requests

Post image
120 Upvotes

r/PythonLearning • • Aug 08 '26

Showcase My first solo project! (Loan Calculator

Post image
119 Upvotes

I recently decided to switch my car loan and I’ve been putting a lot of work into learning python so I thought I would try and make myself a calculator to see the different amount of interest I would pay.

I’m about a week into my learning so far so I would love advice or more learning sources if anyone wants to leave some! I’ve gone through the wiki and done my own research. So far bro code on YouTube and Angela Yu, 100 days of code have been great for learning! I also have Python crash course which I’ve been using as reference when I forget something!


r/PythonLearning • • Oct 03 '25

Starting to learn programming with Python

Post image
118 Upvotes

Any suggestions on how to start


r/PythonLearning • • Nov 08 '25

Help Request What’s the issue with my code?

Post image
117 Upvotes

I’m beginner in python and still really struggling because of my learning disabilities and autism, if someone can explain to me what the issue is with my code that would be much appreciated!


r/PythonLearning • • Jun 03 '26

Showcase Fake Data Generator

Thumbnail
gallery
116 Upvotes

This programme here creates fake Data.

I think this is more useful for Cybersecurity people.


r/PythonLearning • • Oct 24 '25

Help Request User Authentication

Post image
116 Upvotes

I’ve been using Python for a couple of months and I’m working on a project that’s in its beta phase. I want to launch an open beta that includes basic user account data and authentication tokens.

I’ve never built anything like this before (still very new), so this is my prototype idea:

I’m planning to create a function or module that runs on a website, generates a token, and appends it to a user dataset. Then the main program engine will authenticate users using that token.

My question is: has anyone here built something similar, and what kind of advice do you have?

I start college in January, but I’m impatient to learn and want to experiment early.


r/PythonLearning • • Aug 28 '25

Showcase Taught Snake to Play Itself, Added Dumb Sounds too

116 Upvotes

ngl it’s not perfect, sometimes it just bonks the wall for fun, but watching it slowly get smarter while making dumb noises is peak entertainment.


r/PythonLearning • • Apr 12 '25

Help Request “99 bottle(s) of beer on the wall” while loop project question

Post image
116 Upvotes

Program works almost perfect, the song prints as it should but near the end it says “2 bottles of beer on the wall, 2 bottles of beer, take one down, pass it around, 1 bottles of beer on the wall” how do I make it say “1 bottle of beer on the wall” without the s? But also without changing too much of other code. Advice is appreciated thanks for reading🫶


r/PythonLearning • • Apr 22 '26

Help Request Need Opinions

Thumbnail
gallery
115 Upvotes

Can someone run this and give opinions on cleanliness and scalability? New to programming. Super simple fight simulator between Appa and Momo lol.


r/PythonLearning • • Jul 11 '25

Code won't print

Post image
115 Upvotes

What's the error?(I'm a newbie)


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 • • Nov 19 '25

Why isn’t this working

Post image
113 Upvotes

Hello im having a problem using my python code and sorry if its like a dumb question im really new at this


r/PythonLearning • • Sep 13 '25

Showcase Made an open source keyboard-driven python text editor

113 Upvotes

Kryypto is a lightweight, fully keyboard-supported python text editor with deep customization and GitHub integration.

✨ Features

  • Lightweight – minimal overhead

  • Full Keyboard Support – no need for the mouse, every feature is accessible via hotkeys

  • Discord presence

  • Live MarkDown Preview

  • Session Restore

  • Custom Styling

    • config\configuration.cfg for editor settings

    • CSS for theme and style customization

  • Editing Tools

    • Find text in file

    • Jump to line

    • Adjustable cursor (color & width)

    • Configurable animations (types & duration)

  • Git & GitHub Integration

    • View total commits

    • See last commit message & date

    • Track file changes directly inside the editor

  • Productivity Features

    • Autocompleter

    • Builtin Terminal

    • Docstring panel (hover to see function/class docstring)

    • Tab-based file switching

    • Bookmarking lines

    • Custom title bar

  • Syntax Highlighting for

    • Python

    • CSS

    • JSON

    • Config files

    • Markdown

As for now its not meant to replace IDE's (yet).

Please give it a try, comment your feedback, what features to add and give a star to support the project :).

Repo: https://github.com/NaturalCapsule/Kryypto


r/PythonLearning • • Sep 06 '25

day 4 of learning python

Post image
113 Upvotes

I just started my first small project, implementing what I’ve learned so far. I recently began learning about the def statement, so I'm not sure if I'm using it correctly. Any tips would be appreciated, im coding for about 2/3 hours a day using the book 'automate the boring stuff with python' second edition . this my first ever reddit post so it feels weird sharing my progress and if im on the right track.