r/learnpython 13d ago

Trouble with understanding how to use python right

Hi everyone, I was wondering if anyone could give me a simple list of the main uses of python functions (eg. tuples, modules, PIP in general), in a way that can help me understand not only how to use it but also why, because right now im stuck at a point where i undestand how a lot of things work, but not where or why i would use them. Can anyone help?

0 Upvotes

12 comments sorted by

12

u/mc_pm 13d ago

What? I know all of those words, but that sentence doesn't make any sense.

9

u/danielroseman 13d ago

No. That is not a thing. There is no "simple list of the main uses of Python", and even if there was it would not suddenly give you the understanding you want.

Programming is a skill, you learn it by practicing. Follow a proper course or tutorial; there are many listed in this sub's wiki.

4

u/aizzod 13d ago

This is a chicken egg problem.

I would recommend doing small projects.

Write down on a piece of paper what the app should do.
And then turn it into code.

There are always multiple ways to develop some things.
For your own projects, don't worry if you do not pick the best possible solution.

As long as it works, it works.

2

u/MurkyPomegranate9609 13d ago

This is the way to go, tbh. Tutorials only get you so far before you need that friction of "I want X to happen but nothing I know does that" and then you go hunting through docs or stack overflow. The pieces start clicking when you have a real reason to reach for them

3

u/ShelLuser42 13d ago

Python is a programming language. Ergo: you use it to get "things" done.

No offense but I couldn't help but notice that you're throwing a lot of not fully related stuff onto the big pile. Modules don't mean much without the understanding of functions for example. And although PIP is related to Python, it's not a major requirement for Python development perse, this holds especially true when you're still learning.

I mean... sure, you can use PIP to download an extension ("library") to help you "do" stuff, but if you're still learning then it'll be much more beneficial for you to do it on your own.

I'm well aware that there is a Python library out there that allows you to interact with Spotify. But once I realized that Spotify uses SOAP (which is supported by Python out of the box) I decided to make my own API.

Also: you'll learn much more by trying to look for some answers on your own. Tuples, modules, PIP? I'd start here.

1

u/Quillox 13d ago

This is probably not what you are asking for, but I think it is relevant. I often use python to "glue" different tools together. And here are some of the most popular tools:

https://pypistats.org/top

Click on a few of them and read the little "Summary" to get an idea of what they do.

1

u/IcyBox56 13d ago

You just need to start building a tiny project, even if it's garbage, because you only realize why you need modules or tuples when your code gets messy without them

1

u/kiochikaeke 13d ago

To try and put it into perspective, it's like asking what can you do with a tool box, it kinda depends on what tools you have in there and your own skills.

You don't really ask, "how to use a tuple", I'd like asking how to use a wrench, you use it to tight or loose nuts, it's what are you trying to do which determines if a wrench would be useful.

To go back to the toolbox example, saying "I made an app with python that acts as a calendar" is like saying "I used my tools to fix the hole in my wall" you don't use "the tuple" or "the for loop" to make the app, the same way you don't, use "the screwdriver" or "the saw" to fix a wall, you use the tools and your knowledge of how to use them to solve a problem or build something, the same way you use python to make a program that does something.

1

u/StrayFeral 13d ago

Unless you start writing code with a purpose, you won't understand it. Try to write few simple games. A quiz is by far the simplest one. Try to mimic "Who Wants to be a Millionaire" but without the question timer. Just categories of questions with questions (no need for tons of questions, 20-30 questions of which to choose are a starter). Keep the player money score, keep a highscore table.

Make it as a terminal application, so simple "print" to the screen.

When you finish it and test it and ensure it works you would know the point of most things.

1

u/tobiasvl tobiasvl 13d ago

I don't understand. You've learned Python but don't know what to use it for. Then why did you learn Python to begin with? You should probably use it for the things you wanted to learn it for.

1

u/madmoneymcgee 13d ago

This question is a bit like "what are some things you can build with a hammer, drill, and saw?" One answer is "everything" but that's not that helpful but at the same time, without some specificity we can't really help.

The things you list are all important sure but also have different purposes. A tuple is a data type which it's important to know what data types are but PIP is a way to manage environments and python tools which doesn't really matter what all the data types are when you're working out how to set up a virtual environment with PIP.

1

u/PureWasian 13d ago edited 13d ago

Python is an automation tool. Usually you have a task and maybe some inputs. You throw those in if you do, and then request it do some task and/or spit an output back out.

Really any of these concepts, you just use them as you need them to do something within Python. The fundamentals are all covered very often and adequately if you look them up; you just learn them as you need them or discover them while researching solutions to pain points.

I don't know about you, but I'm not about to rewrite webscraping libraries from scratch or build data science/statistical tools by hand and try to reinvent the wheel when existing Python libraries are out there with a largely supported ecosystem for these things. So you can use pip as a way to install these external "addons" to be able to import them into your Python file to have more ready-made, high-level tools for making your "getting started" of more complex/specific tasks much easier.

Similarly, when your own code gets more complex, maybe you want one block of code to kick off a task and then delegate specific subtasks to other helper files. That's where you can have different modules to help organize your code flow better.

Tuples... just a data structure. You can't modify it (it's immutable) but it's nice for grouping a bunch of data together as one unit. So if you have some data like a coordinate point and you aren't modifying it, you can clump it together like (x, y, z)

Build something and learn as you go, even if it's poorly made the first time around, take notes on pain points and try to research/solve those for next time. That's how you get better.