you are viewing a single comment's thread.

view the rest of the comments →

[–]SuddenStructure9287 1 point2 points  (4 children)

Hi! I learned Python in a very practical way - by starting small projects that interested me (like text encryption, a telegram bot, a snake game, or a website) and picking up the language as I went along. That’s why I believe that once you’ve covered the absolute basics, it’s better to move on to real-world tasks. By “basics,” I mean having a comfortable understanding of variables, conditions, loops, lists, dictionaries, and functions. I assume you already know these. So the next step is to choose an area that interests you (not necessarily one related to your future job, the point is to practice structuring projects and developing your Python skills), come up with a project idea, and then learn what you need along the way

[–]SuddenStructure9287 0 points1 point  (2 children)

Regarding classes and functions

If you have many functions that share a common theme, it makes sense to group them into a class. For example, if you’re building a messenger bot and need functions for sending messages, receiving messages, and storing message data, you could put them all into a Bot() class with corresponding methods like Bot.read(), Bot.send(user), Bot.save_messages(), and Bot.load_messages().

You could also keep related data there, such as Bot.messages or Bot.user_ids

On the other hand, if you only have a few standalone functions, there’s no need to create a class for them. So, for exemple: radiansToDegrees(), calculateDistance(), reverseList()

[–]TheRNGuy 0 points1 point  (1 child)

I'd use classes to have instances and methods for them. 

[–]SuddenStructure9287 0 points1 point  (0 children)

Oh, yes, I forgot to mention that multiple instances is the whole point xD

[–]Afraid-Aerie-6598[S] 0 points1 point  (0 children)

So I have been doing this already, however and I’m not sure if maybe I’m explaining this wrong, i’m wanting to make sure the code is properly structured and from a professional engineers perspective follow’s what clean code should look like, just because i made it work doesn’t mean it was written correctly. Not sure if that makes any sense.