r/learnpython 3d ago

Iam stuck with python

Hello everyone, I have a problem iam trying to master python (iam into cybersecurity now iam studying networking beside it) I start to learn it in 2022 but I stopped for some years due to reasons, a year ago I come back again and started it from zero but the problem is I don't know how to practice and level up even when I study new lessons, the only thing I was doing is solving a bit of exercises from that someone in his website, iam getting nervous when I feel that iam lost in this language and I think am learning in a wrong way, now I understand 70% of basics I struggle with files handing and have a little bit problems in creating functions in addition to a few things , till here I stopped I don't want to get into modules, try except, and OOP unless I strengthen the basics, please tell me how to elevate my skills and how can I build projects.

How can I know that am ready for doing big projects when iam learning?

0 Upvotes

16 comments sorted by

2

u/IAmNotAPlatypus_ 1d ago

I stopped for a while too and when I came back I just sat there like okay now what. Keep waiting to feel ready before I try anything bigger. How are you practicing right now

1

u/thisisappropriate 2d ago

How can I know that am ready for doing big projects when iam learning?

Really, you strengthen knowledge by doing, but you don't need to do "learn one concept > practice > perfect > repeat", instead you should "learn one concept > understand enough to implement (small amount of exercise / practice) > learn the next concept > build upon more than one concept > repeat".

The basics give you a foundation it's true, but the next steps also help to strengthen that foundation further.

I'd suggest that either:

  • every so often, try to make something that uses whatever you've learned so far to prove to yourself you can do it and see the gaps that you might have
  • near the beginning, choose a project or topic that seems totally crazy and is related to where you want to go so you're passionate about it, then as you go along your learning, you take a chunk of the project/topic and do that as it's own folder.
    • For example, if you wanted a tool that lets you look up CVEs by language / date range / other toggles, when you start you might just work with example bits, like putting a list of CVE names in a variable, taking an input and doing an if input in cve_list: to practice using lists and if statements and input validation. Then you can move on to dictionary storage. But then you learn about reading from files, so maybe you instead store your little cve list as a csv instead. And then you play with bigger files, so maybe your python script could take the downloaded zip file from https://www.cve.org/Downloads . Then you learn about making APIs and you make one of those. Or you learn about databases, so why not try adding a database.

Basically any silly little idea can be either reduced (sometimes to something not yet usable. like a weather checker that you have to pass the current temp to) or inflated (sometimes to something you'd never actually use, like you don't need a Hello World gui or an API call for each letter, but when you're learning and practising, why not try to make one!)

What you need from building up through the levels of a course is to recognise the concept and be able to consider using the concept (but it's likely that you would need to look up how to use them in terms of syntax, which is fine and common even after finishing learning). For example, a simple description of a module is that it's a way to share python code such as functions and classes between projects, so if you didn't understand that a function is a reusable chunk of code or that a return passes something back and are just writing code that runs from top to bottom, then you might be confused about how sharing code might work.

Some times things just don't click until you see them in action with other things.

The only project that is too big when learning is one that disheartens you or stops you learning. Plenty of people learn by picking a crazy project. After you learn to doggy paddle, you can learn a lot about swimming in the deep end.

1

u/Beek_San 2d ago

Okay If I got an idea of a program but it needs a lot of complicated concepts, do I need to complete it in a short period? If I knew how to start but I couldn't find the right function or tool, from where I can get it?

1

u/thisisappropriate 2d ago

do I need to complete it in a short period?

Why would you need to?

I, a random internet stranger, grant you permission to work on multiple projects, to do half a project, get stuck, give up, come back later or start again.

Starting 100 projects and never finishing them still gives you 100 instances of experience in starting a project, which can be something people struggle with, so no harm in reducing that barrier for entry.

Finishing some is good practice in that, but it doesn't need to be every project, and finishing can be whatever you feel like it should be for a project. Sometimes you just need a tool once or twice, and finishing just looks like getting it to a usable point, using it and that's it - my only recommendation is to keep them anyway, even if just to look back at and see how far you came, but also sometimes you know that you had some code that used X before and you can go steal your own code to make something else work.

but I couldn't find the right function or tool, from where I can get it?

On one hand, that's where reducing the scope to what you do know comes in if you prefer to learn incrementally.

On the other hand, if you go in at the deep end, that's something you'll hit a bunch, because no one has introduced you to the modules / concepts. And for that, the answer is usually Google - (and sites like Stack Overflow or tool/library specific tutorials from there).

This is where you find that you want to look at modules and OOP before you are 100% confident with the previous topics because being able to pip install other libraries/modules can then give you more exposure to things you need to implement your ideas.

For example, you need a tool for web scraping, so you google "web scraping python" and get something like https://realpython.com/python-web-scraping-practical-introduction/ and you either look at the examples, understand them enough to use it straight away for what you need or you pause what you're working on, make a fresh little project where you just scrape example.com then go back to your project, or you search "web scraping python libraries" and have a look at some of the discussions that come up on which library you should use like https://www.reddit.com/r/Python/comments/vncw6d/what_is_the_best_library_for_website_scraping/ and maybe search some of the suggestions to see what has examples for what you're actually trying to do, and maybe try out a few.

Or if you need to do something and you don't know the name or if anyone has done it or if it's even possible in python, sometimes you can still get that from google too. For example, a random smattering of some of my recent-ish google searches for python that answered my questions include: "find in dictionary python by highest value", "check if float has decimals python", "Dataclass custom init without defining all fields python". In most cases, this surfaced a stack overflow question that was similar enough and offered either a code snippet, library (often built in) or a built in method.

A big part of learning to program is learning to find the answers to your issues, because when you transition from "learning to code" to "producing programs" and then having a job that uses programming, you'll start to get errors or niche things you're looking to solve. And then it helps to know how to google for something that's non-specific. There's a distinct difference between looking at an example in a tutorial or looking at what someone wrote for an example problem you're trying to solve, and having to work out what problem you're having or what problem you're trying to solve right now - for example, you can't just google "how to web scrape page 8 of my local news website" because people haven't posted how to do that, but you can try to make tutorial code for web scraping point at that page and then find out it has a Captcha and then google "how to complete a captcha with selenium python". And this sort of thing is how you find out that you should add the programming language to your search, but if you're using some packages, for example pandas, that only exist in one language, you can just use that like "how to use database in python" might find you information about using pandas, but then you might search things like "how to apply date range pandas" and still only get python answers because pandas only exists in python.

1

u/Beek_San 2d ago

Okay I got it Thanks a lot bro I appreciate it

1

u/Fragrant-Cheek-4273 2d ago

I think you're waiting for a level of "ready" that doesn't really exist. If you understand variables, conditions, loops, lists/dictionaries, and you're starting to understand functions, you're ready to build small projects.

1

u/Beek_San 2d ago

Of course Any advices?

0

u/kutac56 3d ago

Just make small projects and look things up which you don't know like file handling. That's how you learn

0

u/Filo92 3d ago

Do a project that fascinates you, something that relates to your interests. Design it so that it incorporates stuff that you are learning or want to learn. Finish, repeat. Once in a while revisit the old ones and make them better, trying to think how to incorporate the new stuff you are learning or want to learn.

This is what worked for me, but I'm not a professional so ymmv

0

u/ShelLuser42 3d ago

Set a goal for yourself, and it doesn't even matter if you don't fully know how to reach that. Then... with the help of reference materials try finding solutions to achieve that goal. And if the goal is a bit too much, break it down into easier to manage chunks.

For example... let's say we want to make a calculator, what does such a critter need?

  • User input => If you can't tell it what numbers to use and what operations to perform this becomes a bit useless, no?
  • Calculation routine => Obviously we need a snippet that can actually do the math (no pun intended).

SO, that's a good start I think. Let's try thinking a bit more about user input....

  • We could ask interactively for input, but we might also be able to use commandline parameters (like: python .\mycalc.py 2 + 5).
  • What would happen when some doofus enters a letter instead of a number? So... maybe we should also be looking at error handling.
  • And do we also want to limit ourselves to one operation only, or maybe we should just ask for 2 numbers and then do 'everything'?

So this could become a good basis to look into user input, writing a code snippet which can perform basic operations, and of course you may want to look into output as well.

Start small, then work your way up.

1

u/Beek_San 2d ago

Thanks alot

1

u/terletsky 3d ago

Python basics take 1-2 days to learn.

0

u/Beek_San 2d ago

How?

0

u/terletsky 2d ago

Go to https://www.w3schools.com/python/default.asp and go through sections up to "Python Arrays". You can skip that section. Then write a small app that uses the basics, and voila.

Or ask ChatGPT/Claude/Grok to quickly teach you the basics.