r/learnpython • • May 17 '24

Where to learn USEFUL python?

Hello!

I'm talking about python that will actually help me write scripts I want.

Earlier around 2019, I did an in-person python class with someone popular in my city and he literally taught me nothing but simple syntax and functions, which I already knew before attending. This wasn't supposed to be a basic class, mind you. This just shows the level of python knowledge my country has.

Anyways, I want to program a plan organizer/alarm app for starters.

I only know python basic functions and syntax.

Help me. Where to go from here?

0 Upvotes

17 comments sorted by

View all comments

15

u/Bobbias May 17 '24

The key here is problem solving, not learning the "useful" parts of python. You've already learned the useful parts of Python!

Once you know the basic syntax and language features, the next thing you need to do is learn how to apply problem solving.

You have to get creative, look at the problem and figure out what the actual requirements are, and use that to constrain the kind of solutions you need.

This is arguably the hardest part of learning to program. Typically the advice I give people is to start small and simple. Whatever classes you've taken have probably asked you to build extremely basic programs. Start at around that level, and make something completely on your own. If you can do that easily, then you're ready for more complicated problems. If you struggled to figure even that out, you need more practice on problems of that kind of difficulty.

Problem solving like this is a skill that you must develop with practice, and the only way to practice it is to solve problems. The key skill you use in problem solving is breaking large problems up into smaller more manageable pieces.

Imagine an alarm app in it's simplest form: you give it a date and time, and it waits until that time and then writes a message on screen to notify you.

What are the requirements of this program? It needs to take user input, it needs to store that in a variable. It needs to use a mechanism to wait until the specified time. It needs to print out a message.

For an example of breaking a complicated problem into smaller pieces, let's look at waiting for a specific time: python provides us a way to instruct our code to wait for a specific length of time. But it doesn't let us tell it a time to wake up. So we need some way to know when we've reached the specified time. What we can do is loop over and over, and check what time it is every loop. If we haven't reached that time yet, we do nothing. If we have reached the time the user gave us, or gone past it somehow, then we stop looping, then print out the message.

This is a plan that describes how we can implement the most basic form of alarm app. From there we can think about how we might extend that to do more complex things, one part at a time. We can think about how the user might interact with the program (does it have a GUI? If so, what should the GUI look like? How do we implement the GUI? Is there a specific library we want to use? How do we implement XYZ GUI feature with the library we chose?), we can think of extra features we might implement (Can users attach events to certain dates and times? How does this appear in the UI? How does the user add an event? What information is required for an event to be added? How do we store this information? Does this information need to be saved in a file for later use?).

A lot of this can be planned out before you write a single line of code. And in fact, once you have a rough plan for what you want to make, that plan can tell you a lot about what you need to know in order to implement the different features you want.

Typically you want to try to get something simple up and running first, but the exact feature you implement first is up to you. You could start out like I did with a super simple alarm program. Or you could start trying to build a GUI for things, or you could start building the organizer section. I chose the alarm because it's the simplest part to implement, and once you get the basics down, you can start adding additional features. You can expand it by letting the user add multiple alarms, or you could add a simple GUI, or you could make it play a sound instead of printing to the console when an alarm goes off... There's a lot you can do to build up more complex behavior once you've got the basics down.

There is no one specific way to start a program like this. You just start somewhere and keep going from there. The key is making sure you know how to take a big idea and split it up into smaller simpler ideas that you can actually figure out how to start writing. And if you're really stuck breaking a problem up into smaller pieces like that, you need to start smaller and simpler to get that practice in before you move on.

1

u/iamevpo May 17 '24

Skip the GUI part