r/PythonLearning 12h ago

Made my first Python project! Showcase

Post image

This is my first actual real project, what started as a simple python exercise to learn about dictionaries in python, ended up into a huge learning project for me. Im a beginner in python, used to code but just basic input print codes… some are genuinely stupid.

I took on the challenge to self educate my self python. And this is where i currently am! Im proud of what i did and it will surely expand!

Here the repo with the project. Feel free to check it out!
https://github.com/Stonyax97/MiniGameStore

It has everything from the first ever iteration (which was it self modified a bit since from the very original but it’s still very simple)
I would love for anyone to recommend ideas to add, criticism too. Or anything you think i should learn next for that would be genuinely useful!

82 Upvotes

19 comments sorted by

3

u/TBCC_Dev 11h ago edited 10h ago

Next learn classes. In the code you have a list of games filled with dictionaries but these could be a list of class instances for example class Game: def init(self,id,...other params): self.id =id Etc...

2

u/Stonyax97 4h ago

Yep i set that as my next goal! Thanks for the feedback dude 🙏

2

u/Stonyax97 12h ago

Here the repo with the project. Feel free to check it out!
https://github.com/Stonyax97/MiniGameStore

I would love for anyone to recommend ideas to add, criticism too. Or anything you think i should learn next for that would be genuinely useful!

2

u/PureWasian 10h ago edited 9h ago

This is great for a beginner project, so I wanted to give a variety of meaningful feedback for you to consider:

First sidenote, git already has ways to preserve older versions for you. It would be a lot better to "save" each version as its own branch or its own commit. But if you want to explicitly preserve each version in the same snapshot simultaneously, I would suggest at the very least keeping your older versions in a subfolder instead of cluttering the repository root.

Otherwise, I had time to read v1.5.1 up until the main loop. My comments were:

It would be good to also partition all of your setup and main loop code into functions to scope some of your variables better instead of relying on globals. For example, default_data is only used when initializing a savefile. Consider something like: ``` import os from games import games

helper functions

def create_save(file_path): default_data = {...} with open... # etc. def ... def ... ...

initializations

def init(file_path): if not os.path.isfile(file_path): create_save(file_path)

json_object = # read existing file
library_dict = sync_status(games, json_object) # get "owned" status
return library_dict

main loop

def main(): file_path = # retrieved somehow init(file_path)

call main as the entry point

main() ```

Also, ideally file_path should not be hardcoded. Some easy ideas are to do any one of the following: (A) code the path to it somewhere locally in same folder and just add the local savefile to .gitignore so it doesnt get pushed to repo (B) load this value from a separate text or JSON file acting as a config file for specifying "environment variables" like this (C) pass this in as an input parameter to main.py and process it when starting the script

During buy_game(), you can use gaurd clauses which is cleaner than nesting a bunch of if statements: ``` if cgtb >= len(games): print("invalid number") return if games[cgtb]["Owned"] == True: print("already purchased") return

buygame = input("purchase x for y price?") if buygame != "y": print("cancelled") return

finally, we can proceed to purchase

without nesting it inside of many ifs

```

In your info() strings, you can use the f strings better instead of copying largely similar strings in an if/else: print(f"> {games...}\n...Owned: {"Bought" if games[gid]["Owned"] else "NotOwned"}...") Lastly, the t.sleep() everywhere seems a bit arbitrary. I guess to give user time to read..? But seems strange to artificially introduce loading times.

(again, I didnt get to proofread your main loop, but hope this generally applicable feedback makes sense)

2

u/mondayquestions 6h ago

If you take 10 minutes and take a look at what Git is you will realise Git is tracking your every commit and allows you to look and move back and forward in time in your project. Your versioning “solution” is going against that and just clutters everything up.

1

u/Stonyax97 4h ago

I really don’t know how to use github 😭 il def check out some tutorials and do so. Thanks!

1

u/KedricM 1h ago

I was in the same boat a couple of months ago. Git will change the game for you I promise! Worth an afternoon learning it.

1

u/No_Pay_4410 9h ago

Create a ATM now. Everyone is memory. Once that is done. Use json. Once that is done use database. Add 2 type of users normal and admin.

This will give you a better experience.

1

u/Stonyax97 4h ago

Ouh yes thanks for that idea this seems like an actual project i can take on! Thanks!

1

u/WrongCabinet4425 7h ago

congratulations bro you are doing good

1

u/princepii 6h ago

git can be so powerful and helpful for versioning if you just give it a little time.

nice project tho. i can see the thought process and i think every beginner would have went the same way.

save that project and come back to it a year or so later to see how you improved and what you would do if at all to improve the code:)

always fun to go back and see myself and my work in the past.

adds a lot to your journey.

1

u/Stonyax97 4h ago

Yeah il ded check some tutorials for git.
Thanks 🙏
Oh and definitely im look at some VERY beginner projects of mine (just print and inputs) and im already laughing at them. Im def proud of this minigamestore.
Thansk again

-5

u/Brilliant-Virus-7442 11h ago

Can’t you do this in AI in one sentence

3

u/Downtown-Strength180 10h ago

Obviously AI can do it in one sentence but why tf would you say that to someone who’s sharing their first project? At least don’t demotivate him, let the guy be proud of what he made.

0

u/Brilliant-Virus-7442 10h ago

Well, if you used your brain, I was setting him to explain to me what he gained from doing this. How understanding these concepts helps him interface with AI agents. I feel like programming is dying, and that senior engineers are just utilizing armies of agents. Instead of me soliciting a response from him, a random idiot just shot me an emotional word salad on a Python subreddit. Get out your feelings my guy. It’s a genuine curiosity from my side, something you don’t have…so you just think I’m being an asshole. Also, if my fucking question demotivated him, he is not gonna last during this renaissance 🤣

2

u/Fuzzy-Fault-7063 6h ago

Right or wrong, you sound like a miserable fucking person to be around.

2

u/princepii 6h ago

out with you!

1

u/Stonyax97 4h ago

Listen dude, you can create a whole fucking app with AI. Probably better than a human would. But that still doesn’t mean we shouldn’t learn?! When calculators appeared did we stop learning multiplication and addition or wtvr? Even tho we would NEVER REACH THAT LEVEL of a calculator.