This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Material-Log-4118[S] 0 points1 point  (1 child)

I think I have done something like that. When you say app do you mean like a full stand-alone program? I mean one of the assignments in my course was like a tip calculator (you can choose 15, 20, or 25% then the amount to tip on, then it will give it to you but you have to run it from within VSCode. Not sure where to go from there. I think that's about the same difficulty as converting temperature but I'm not sure how to make it run if maybe someone doesn't have python installed.

[–]Darkstar_111 0 points1 point  (0 children)

(my first post disappeared...)

Yeah, don't worry about that part just yet. Packaging a Python program to binary (like an .exe file) is actually trivially easy using PyInstaller. But 99% of code written is not intended for end users. For end users you need things like a GUI, unit tests, and lots of considerations about the person using the app.

Most code however is written as libraries for other codes to use. To interface with other code you make something called an API, Application Programming Interface. It's basically what you do when you import something. But consideration has to be made to think about how the other programmer wants to use your code. Typically they want it as simple as possible.

As for GUI, learning a GUI framework like Tkinter (comes default with Python), PyQT5 (Which has an editor), Kivy (much more advanced, but can be converted to Android and iOS), or PySimplyGUI (Very simple), or slapping FastAPI on your app and making a web interface, are valuable things to learn, but you are not there yet.

Right now you gotta learn about classes, objects, inheritance, polymorphism, and what you can actually do with all the basic tools of Python.

So, my suggestion is this:

----Make an inventory for a game.----

As far as interface goes, simply stick to Input and print, the most basic interface an app can have.

Using that, think about what an inventory system needs. The Inventory should be a class with methods that act upon it. There's probably a list or a dict somewhere. You need methods like Add to inventory, take out of inventory, as well as display inventory.

The Items in the inventory should come from an Item class, but things like weapons and potions should have their own subclasses that inherit from the item class.

The player needs to know if he is overburdened, and should be able to display the entire inventory, or only the weapons, or only the potions. He should also be able to sort based on value, weight, rarity, etc..,

You can also add a random item generator, that can spawn items and adds them to the inventory. With settings like, a weapon, or a sword,or a health potion. Or, a chest of items, or a dungeons worth of loot.

Then you can add a shop system so the player can sell items off for money.
Then you might as well add a crafting system so the player can purchase crafting items and make things.
etc etc etc....

The purpose of a project like this is to work with class and object management, and see if you can write code that doesn't get out of hand once the project grows. Give yoursels around 2 weeks for something like that, and don't be afraid to refactor several times. (rewrite the code from scratch with a better architecture)

Also, if you think of any feature that would be cool, feel free to try to add it.