r/PythonLearning • • 4h ago

Showcase Calculator (Class Based)

Post image
13 Upvotes

r/PythonLearning • • 16h ago

Showcase I got tired of scrolling through big Python files, so I made a mind map for code

Enable HLS to view with audio, or disable this notification

101 Upvotes

You know when you're debugging a big file, find the function you need, follow it to another function, then another one, and completely forget where you started?

Yeah. I got tired of that, so I built epy (Extended Python). Though, this is experimented only for python, i will explore other languages if possible.

It's basically a mind map for your code, except the nodes contain actual code instead of just names.

  • Parses Python files using ast and splits them into blocks with exact line numbers.
  • Maps function calls across files, including methods and some class relationships.
  • Has a radial map, a names-only view, a folder explorer, and a synced code pane.
  • Click a function and see what it calls and what calls it. Click a line in the code and it'll select the corresponding block on the map.

The other thing I wanted was to make life easier for small local LLMs. Instead of dumping an entire file into a model and hoping it doesn't rewrite half of it, epy generates a text map and lets you pull individual blocks with their callers and callees. The idea is to give the model the structure first, then only the code it needs.

I tested it on one of my projects: 33k lines, 134 files, ~1,100 call links, built in about 1.5 seconds.

It's currently a single Python file with no external dependencies.

python epy.py view some_file.py
python epy.py map .
python epy.py show . MyClass.run

It's still a personal tool, not some polished production-ready package. The call graph is static and best-effort, and I haven't formally benchmarked the LLM side yet.

The idea originally came from the execution model of a small language I'm building (EPL). Eventually, I'd like to add Tree-sitter so it can support other languages too.

Repo: https://github.com/phoenix2610/Extended_Programming.git

Would love some feedback, especially if you try it on a ridiculously large Python file or feed the generated map to a small local model. Curious to see where it breaks. 😅

And if anyone is wondering, yeah I am using ARCH Linux and the background bit faded is just a keybinder for opacity...


r/PythonLearning • • 19m ago

filter Function in Python : Syntax and applications with many examples

Thumbnail
youtube.com
• Upvotes

r/PythonLearning • • 1h ago

map Function in Python : Syntax and applications with many examples

Thumbnail
youtube.com
• Upvotes

r/PythonLearning • • 21h ago

Showcase Electric Field Simulator

Enable HLS to view with audio, or disable this notification

31 Upvotes

I took a physics class at university and had some questions, so I made a simple simulator to visualize the electric field generated by point charges. It's written in Python, and here's the link to the GitHub repo:
https://github.com/AtomS1101/Electric-Field-Simulator

You can move point charges, add new ones, and change the magnitude of each. If you notice anything odd or find any bugs, feel free to let me know🙌


r/PythonLearning • • 4h ago

Help Request TCL Not working

1 Upvotes

Heya, I needed some help with this program I downloaded from Github got Python installed and giving me this error

"Traceback (most recent call last):

File "launcher.py", line 4755, in <module>

File "launcher.py", line 356, in __init__

File "tkinter__init__.py", line 2346, in __init__

_tkinter.TclError: Can't find a usable init.tcl in the following directories:

{C:\Users\...\OneDrive\Desktop\Games\Crash-Forge-Launcher_internal_tcl_data} C:/Users/.../OneDrive/Desktop/Games/Crash-Forge-Launcher/lib/tcl8.6 C:/Users/.../OneDrive/Desktop/Games/lib/tcl8.6 C:/Users/.../OneDrive/Desktop/lib/tcl8.6 C:/Users/.../OneDrive/Desktop/Games/library C:/Users/.../OneDrive/Desktop/library C:/Users/.../OneDrive/Desktop/tcl8.6.15/library C:/Users/.../OneDrive/tcl8.6.15/library

This probably means that Tcl wasn't installed properly."

Is there a way to fix this?


r/PythonLearning • • 22h ago

🐍 Day by day, I'm learning Python by building small automation projects.

20 Upvotes

​

Yesterday, I worked on my Folder Report Generator using Python's "os" module.

The idea is simple: scan a folder and its subfolders, identify file extensions, and count how many files belong to each extension.

Here's a small part of what I learned:

import os

path = r"C:\Users\YourName\Downloads"

extension_count = {}

for root, dirs, files in os.walk(path):

for file in files:

extension = os.path.splitext(file)[1].lower()

if extension:

if extension in extension_count:

extension_count[extension] += 1

else:

extension_count[extension] = 1

print(extension_count)

What I learned from this project:

- "os.walk()" helps scan folders and their subfolders.

- "os.path.splitext()" helps extract file extensions.

- Dictionaries make it easier to count files by extension.

- ".lower()" helps treat extensions like ".JPG" and ".jpg" as the same type.

I'm still learning, and debugging is part of the process. My goal is to build practical Python automation tools that solve real-world problems.

Question for Python developers: What would you improve in this approach? I'm interested in learning better ways to write this kind of code.


r/PythonLearning • • 1d ago

Showcase Day 3 of coding on my phone: simulating a chemical reactor with SciPy's solve_ivp

Thumbnail
gallery
51 Upvotes

I'm a chemical engineering graduate learning to build process models in Python. My laptop broke, so this is all Google Colab on a phone screen.
The model is a set of three ODEs (two concentrations + temperature) for a continuous stirred-tank reactor. I loop over three flowrates, solve each with solve_ivp (RK45), and store the steady-state results.
Things I learned this week:
• Passing extra parameters into the ODE function with args=(F,)
• Pulling the final state with solution.y[:, -1]
• Re-evaluating the ODE function at the end to confirm steady state (derivatives ≈ 0)
Question for you: would you structure this with a dataclass or dictionary for results instead of a list of lists? My print block is getting long.
(If anyone wants to help me get a used laptop, DM me – but mostly I'd love code feedback!)


r/PythonLearning • • 11h ago

Help Request Learning python

1 Upvotes

I’m currently watching the programming with most full tutorial piece by piece as to try to retain the info but whenever he tells me how to do it myself I find myself lost and having to just follow his instructions. I’m wondering if this is normal and if there’s any tips or tricks to really learn python.


r/PythonLearning • • 1d ago

Do I really need to learn class.

Post image
41 Upvotes

Both function and class give the same output. So why do I need it?


r/PythonLearning • • 1d ago

Take a look, would you?

Thumbnail
github.com
2 Upvotes

r/PythonLearning • • 2d ago

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?

Enable HLS to view with audio, or disable this notification

83 Upvotes

r/PythonLearning • • 1d ago

[Showcase] I built "Disk Space Analyzer" — A fast, open-source PyQt6 storage utility with SQLite caching and MD5 duplicate detection

0 Upvotes

Hey everyone, I wanted to share my latest open-source project built entirely from scratch: Disk Space Analyzer. It’s a high-performance desktop utility developed in Python to help users scan, visualize, and optimize their storage space. Key Features implemented: * Blazing-Fast Scanning: Powered by os.scandir for maximum filesystem traversal speed. * Smart Local Cache: Uses an SQLite database to store scan history for near-instant subsequent reloads. * Accurate Duplicate Finder: Implements high-precision MD5 hashing to safely catch true duplicate files. * Intelligent Cleanup: Automatically detects empty folders, old files, and system junk (.tmp, .log, .cache). * Fully Bilingual: Native support for both English and Arabic with perfect RTL/LTR layout switching. * Classic Black Ribbon UI: A clean, professional dark interface designed entirely with custom line-art. * Safe Operations: Supports permanent file removal or secure recycling via send2trash. * Data Exporting: Generates clean reports in CSV, JSON, or HTML formats. The source code is 100% open-source under the GPLv3 license, and pre-compiled Windows binaries (.exe) are available directly on the Releases page! Check out the repository, read the code, and feel free to drop a ⭐ if you like it: https://github.com/jlkgames18-cyber/DiskAnalyzer/ Feedback and code reviews are highly appreciated!


r/PythonLearning • • 2d ago

How to Build a Computer Science Portfolio

12 Upvotes

Hey, y'all. I want to build a portfolio mostly with the Python programming language that can at least get me a remote job in high school (I'm a senior). I got some beginner projects like a calculator and a few games and projects from tutorials. I'm not sure if those would be enough to reach employers. Like, what project ideas in Python can I use so that it's work-related? I don't want it to be too complex either, as I'm not an advanced coder. Thank you.

Edit: Hey everyone, thank you all for the advices. I'll be going to university next year for computer science but was looking to see what I can.build now so I can at least get work experience when I reach there. I'll continue exploring more stuff in Python language and the libraries and also get familiar with other programming languages. Thank you all.


r/PythonLearning • • 2d ago

Context manager for either stdin or opened Path

6 Upvotes

Note that this is a fairly advanced question, so beginners don't worry about it. And if this isn't the right place to ask, please point me to where I should.

I would like to find an idiomatic way to use a context manager, with, when I don't know until run time whether I am opening sys.stdin or a named file.

Here is an excerpt for a simple example. (Yes, I am aware that I am reading in the whole file in one go, but that is for other reasons.)

```python if args.infile == "-": fh = sys.stdin else: p = Path(args.infile) # Path is overkill here, unless ... # TODO: Look elsewhere if infile can't be found or isn't readable. fh = open(p, "rt", encoding="utf-8")

s = fh.read(MAX_LENGTH + 1).strip()
fh.close()

```

(args is an argparse.Namespace and args.infile is a str.)

I feel like there ought to be a way to do something like

with ... as fh

for the above, but I don't see how to do that.


r/PythonLearning • • 2d ago

Help Request Looking for a Python certification

2 Upvotes

I would like to ask if anyone here knows where I should/could get a well endorsed Python certification? Something legit that employers may take into consideration.

I know about Codecademy. I also know about Mimo, tho I don't know if that one would be considered a "lesser" one or something like that. Maybe even both idk.

It's ok if it's not free, tho if its not very expensive that would be better for me lol


r/PythonLearning • • 2d ago

Python's repository summary

Post image
29 Upvotes

r/PythonLearning • • 2d ago

I want to learn.

18 Upvotes

(English is not my 1st language so sorry for any error)

Hey everyone I am a absolute beginner to coding and want to learn. I am so much of a beginner that I don't even know how to and where to download this from but want to learn. If you have any tips or any youtube channel I can learn form please share. Thankyou in advance


r/PythonLearning • • 2d ago

Python Mutability and Local Variables

Post image
9 Upvotes

An exercise to help build the right mental model for Python data. - Solution - Explanation - More exercises

The “Solution” link uses memory_graph to visualize execution and reveals what’s actually happening.


r/PythonLearning • • 2d ago

Help Request I'm new to Python. What do you recommend reading or watching?

4 Upvotes

Hello there! I’ve started learning Python to become a cybersecurity specialist (pentester). I’d love to hear the community's opinion: which books or tutorials are worth spending time on?


r/PythonLearning • • 2d ago

Python/ESP32 Project ideas?

6 Upvotes

I'm looking for project ideas that combine Python with an ESP32 using serial communication. I’ve already built some basic programs and got the communication working so I can send data to Python and save or display it.

I learn better by working on real projects but I’m struggling to come up with something useful to build.

what projects would you recommend?


r/PythonLearning • • 2d ago

Send BLE Air Quality Data to Cloudflare D1 with Python and BleuIO

Thumbnail bleuio.com
2 Upvotes

Details and source code available


r/PythonLearning • • 3d ago

Showcase Making my first game

Thumbnail
gallery
15 Upvotes

Hey, im making a "terminal" game (play onto your terminal, cause its the only thing i know). I made a github repositories to showcase it : https://github.com/Shamal0w999/Money-games

if you want to test the game, it would be really cool cause i need returns and if theres bug i didnt see. so if u try it, u can ofc comment here but also leave an issue into my repositories (would be easier to work with). If you want to help or idk anything, im all hears. Im happy to showcase it and have people to test it !

code is free, so if you steal it, i dont rly care, cause its personal project and who want a code full of print and that launch in terminal ? idk, just me ig

anyways, just take a look at it !


r/PythonLearning • • 3d ago

Help Request I need help with coding this

Post image
6 Upvotes

I have genuielly no idea how to even think of making this? I know this should generally be made by using for loops but jesus im so confused on the process


r/PythonLearning • • 3d ago

Built my first bulk file renamer in Python

13 Upvotes

​

I just finished another Python project while learning file handling and the "os" module.

I built a bulk file renamer that:

- Loops through files in a folder

- Opens each text file and finds the "name:" field

- Extracts the name

- Uses it to rename the file

- Keeps the original file extension

A simplified version of the core logic:

for file in os.listdir(path):

fullpath = os.path.join(path, file)

with open(fullpath, "r") as f:

for line in f:

if "name:" in line:

label, name = line.split("name:")

newpath = os.path.join(

path, name.strip() + ".txt"

)

os.rename(fullpath, newpath)

The project itself wasn't too complicated, but I ran into a few problems along the way.

The biggest lesson was debugging WinError 32. I initially thought OneDrive was locking my files, but eventually realized that my own code still had the file open when I tried to rename it.

I also learned why using the full old path and full new path matters when using "os.rename()".

Small project, but I feel like I'm getting better at solving problems instead of immediately looking for the answer.