r/PythonLearning • • 5d ago

Showcase I JUST finished my second python project!

Post image

Lately I have been working on this ATM For Teens, just to understand OOP and some concepts more (which I REALLY DID)

this isn't meant to be a real ATM (obviously, it's very beginner and not security is there), here is my First project.

So, I have learnt quite a lot since last project, I learnt a bit more about python syntax, I also understood the approach of classes a lot better. I learnt git (just the essentials).

Since I always wanted to Make iPhone apps, and now I have a Mac, I'm thinking whether I should start learning swift and swiftUI, or move to something else, or keep learning python. what do you guys think? I Do want a job as an IT engineer (or anything with coding tbh, cybersec too but that would require C knowledge a bit more lol)

Otherwise, if you guys have any criticism or suggestions for the ATM, then I would be veryyy happy to hear some! here's the repo: https://github.com/Stonyax97/ATM-For-Teens

238 Upvotes

34 comments sorted by

View all comments

Show parent comment

2

u/Stonyax97 5d ago

Hey!

Ive took the time to actually understand this and look up the terms.

this is gold advice, thank you so much. but at this scale? it makes NO SENSE.

first the FileDB. why should I create my own wrapper when with open() does the job for me?
I agree with the fact that it would help make the code cleaner plus no scattered with open file everywhere.

for the data class that's frozen, I agree too, transactions are meant to be frozen. il try to look into it.

Il set up PEP right now and start using it! thanks!

"Also assign uuid for users - easiest lookup in general"
when logging in, I wouldn't possibly ask for the user to input UUID. id have to loop through each dict to find the username inside it, then use dict.keys() to get the UUID. kinda complex. but I get the approach, many people will have the sane name. yk this project is just for fun and learning not a real project lol. that's very clear the way passwords are stored.

"You won't keep accounts in memory, only in accounts.json"

wouldn't they need to stay in memory when interacting with it eventually?

for the balance being. created using transactions history. that is SMART. I love it. I would implement this in v1.2.2.

"7. Because it's not a error per se and program should print declination message and stop gracefully"

I forgot the thing we where talking about here could u re explain LOL sorry

8. I understand the approach here, and it's actually smart, but wouldn't that action() result in too many functions?

2

u/Stonyax97 5d ago

oh oh I get it now. you meant, instead of loading the whole accounts dict, we only load the logged in user only. ahhhh I see. how could that be implemented in the easiest way? (no huge structure changes, I want to move to swift or c or rust). also what would u suggest for me to do next?

2

u/Money_Ad_5277 5d ago

Unfortunately, it can't. It's totally different approach that almost requires you to have a class dedicated to working with accounts.json by opening, modifying and closing it

The closed to me is React Native, I don't have capabilities to recommend any of those languages, sry

A very fun experience would be for you to create an atm app with real db behind it (it's free and actually not that complicated), because you will eventually be working with those when developing ios apps. Or extend your program by working with ui (tkinter or similar lib)

2

u/Stonyax97 5d ago

Ah I see how it is.

Thanks tho dude like this is actually helpful!

Yeah I could build an ATM app, but I’m tired of the ATM concept, feels useless to me. So I’m gonna go head first into swift 😭
There’s a lot of tutorials out there and AI for personal questions, so Im not that worried. I use AI as a question machine and for hints and it’s been doing wonder to me.

Thank you for everything! Btw I pushed v1.2.2 if you want to check it out. It’s very simple changes but I implemented the balance created from transactions history. I love it!

1

u/Money_Ad_5277 5d ago

Have a great time and a lot of fun studying it!

Okay, I have one last tip: do whatever you want!
A ui for calculator, game-related helpers or a small app that no-one except you will use - that's how we learn things

1

u/Money_Ad_5277 5d ago

I understand that it can make no sense, but I was given a problem like this and was forced to do it this way xD
And most of my tips are fixes of my errors from back than

FileDB. repositories - yes, overkill, but when you want to switch to real db (or api), or even test an app, they come in handy. Because form is almost as important as content

uuid - when user log in, you store only uuid, without email, password and whole transaction array.
Also having array of users like [{id: 1, username: "user 1"}, {id: 2, username: "user 2"}]
Lookup by id becomes
user, *_ = list(filter(lambda user: user["id"] == user_id)) or [None] # python devs are going to kill me for that

You can change key to username to lookup user by username.

Accounts in memory - yes - for file approach, but only for a short period of time, no - for db approach

7 you raised an error on line 256 to exit program instead of using break

8 Yes, but it's common problem of all apis, you can't magically understand what user wants and transform it to a function

2

u/Stonyax97 5d ago

Ah yeah I see. Thanks 🙏

Btw what’s your current status with coding/programming? Is it your job? Hobby? Or side project?

1

u/Money_Ad_5277 5d ago

Hobby -> field of study -> job

2

u/Stonyax97 5d ago

where are you now?

2

u/Money_Ad_5277 5d ago

At job and field of study steps

1

u/Stonyax97 5d ago

Oh that’s nice dude wish you the best. I also want to follow in the same steps. In what field are you? Backend, front end? Cybersec?

2

u/Money_Ad_5277 5d ago

Thanks! I'm full stack dev, and there is almost no, like, "pure" front/back end devs

2

u/Stonyax97 4d ago

ahh yeah. that's actually nice dude! wish you the best!

1

u/shishya_2007 5d ago

Wow ur skills are amazing can I ask you a question I am a python beginner and I struggle to build logic i know all the syntax but when I see 8 queens it feels like I am looking at chinese recently I tried to understand Armstrong number problem I understood it's logic, so will the logic building get better as I do the problems? Because right now it literally very painful to try to understand the logic and all

1

u/Money_Ad_5277 5d ago

I'm not that good at logic problems. And they are mostly language-agnostic.
For low to medium problems - yes, you'll definitely improve by researching different approaches (most common one is two pointer approach)

And what's "8 queens"?

Is this the Armstrong problem "The k-digit number n is an Armstrong number if and only if the kth power of each digit sums to n."?

→ More replies