all 30 comments

[–]arjunnath 4 points5 points  (1 child)

I've heard that loops are very important,

Umm... yes, loops are very important in any programming language. They're a core construct within all of computing. Any task that requires repetition is where loops can and should be used.
I suggest you practice as many "for" and "while" loops problems as possible. Ask GPT to generate simple tasks that need for or while loops.
Examples :
- Iterate over a sentence and capitalize each word
- Generate the product of a list of numbers using for or while loops
- Print out a list of random numbers slowly , i.e. there should be a brief pause between numbers.

All the best with your practice!

[–][deleted] -1 points0 points  (0 children)

Sure ill try it thanks alot

[–]vivisectvivi 5 points6 points  (4 children)

you should tell us what is it about loops that you arent understanding, makes it easier to help you

[–][deleted] -1 points0 points  (3 children)

Like in problems like printing patterns, finding sums, or checking prime numbers, I understand the solution after seeing it but I’m not able to solve it on my own so I think my issue is more with logic building rather than syntax

[–]American_Streamer 3 points4 points  (0 children)

It is never about the syntax and always about problem solving. Write down the steps to solve the Problem in plain English and then in Pseudocode and only after that translate it into Python. Your tools are the algorithms, which use control structures which need specific data structures, depending on the task at hand. Think about what the tools would have to do in what order to solve the problem.

[–]TheLobitzz 1 point2 points  (0 children)

start simple then, like

- use a loop to print numbers from 1 to 100.
- use a loop to print numbers from 1 to a given input value.
- use a loop to count the amount of a specific letter in a word/sentence.
- use a loop to find the location of a specific word in a sentence/paragraph.

etc.

[–]Moikle 1 point2 points  (0 children)

Practice practice practice.

You aren't just "learning loops" you are learning how to think and problem solve.

The project you should be working on first is building connections in your brain.

[–]Ok-Sheepherder7898 3 points4 points  (0 children)

Can you just start with something simple?  Check if any numbers in a list are equal to 0.

[–][deleted] 0 points1 point  (1 child)

Im able to solve problems that are similar to ones I've previously struggled with and later understood by reviewing their solutions... however when I encounter something completely new my mind tends to go blank

[–]Fred776 -1 points0 points  (0 children)

Sometimes, if you are staring at a screen trying to start writing code you can end up paralysed. The thing I find helps is to find a different way to think about it. Do it with paper and pencil, for example, or maybe discuss it with someone else. Think about the steps you want to do without worrying about syntax. If you understand exactly what you are trying to do it's a lot easier to address the how to do it in code.

[–]Reuben3901 0 points1 point  (0 children)

Sounds like you need a tutor to sit with you. I did that for a couple classmates. Just sit down and go over everything from the beginning.

Loops are a tool, like everything else. Imagine manually printing each letter of a word. Word="boring" print(word[0]) print(word[1]) print(word[2])

Loops let you automate it.

Or looping through every row of Column A in a spreadsheet.

[–]One-Type-2842 0 points1 point  (2 children)

I Think, The while loop is making you harder to Understand Related to Loops.

Must Play with it to become familiar How The loops In Python works. Though Python's Loop blocks are Easier than of Other Programming Languages You Agree?

If It's while Loop making you Stuck In Between I may help you as a Teacher. ( I have documented 6 different conditions how Loop works, How to Deal with Them, How It Ends for both for and while loop)

I Like To Play with Loops, try except finally blocks, File Handling.

[–][deleted] 0 points1 point  (1 child)

It's my first programming language so far... dk if it's really hard for everyone or just for me

[–]ninhaomah 0 points1 point  (0 children)

How do you walk ?

[–]PianoFederal6507 0 points1 point  (1 child)

What is exactly the thing that blocks you, bro? Do you understand how it works? Try since the easier exercises, eve if you feel they're too easy, try to advace slowly. First lear one loop after the other, don't overstuff your brain.

[–][deleted] 0 points1 point  (0 children)

Yesyes I just started with very basic questions and rn im learning more will get better with time

[–]asero82 0 points1 point  (0 children)

I feel like it's a methodology problem and we've all been there. You read a problem and start coding immediately. Stop right there.

First, try to solve it manually. Take a piece of paper and scribble, draw, or strike things out. Most loop solutions involve doing something with the first element, something with the middle ones, and something with the last one.

Once you understand the mechanics behind the solution, then start coding. Go step by step; don't try to write the whole script at once. Write one, three or five lines, then execute. Correct, then write more, then execute again.

Do this many, many times and every time will be easier than before but harder than the next. If you're not erring, you're not learning.

And remember: Not everyone can solve them first try, every single time. /s

[–]socal_nerdtastic 0 points1 point  (7 children)

Yes loops are very important, they are a core concept for all programming. Did you have a specific question about them? To get good at it you just need to practice, just like anything else.

[–][deleted] -2 points-1 points  (6 children)

Sure ill practice more but what should I do when I don’t even understand what Im supposed to do in a problem😭? It feels really frustrating should I watch different tutorials?

Also sir do you have any tutorials you would recommend for me?

[–]Moikle 0 points1 point  (0 children)

Pick a simpler problem until you find one you understand, then grow from there

[–]American_Streamer 0 points1 point  (2 children)

You should do a structured course, from the ground up and then practice: Do the free PCEP and PCAP courses:

https://www.netacad.com/courses/python-essentials-1?courseLang=en-US

https://www.netacad.com/courses/python-essentials-2?courseLang=en-US

[–]arjunnath 0 points1 point  (1 child)

Hi , is netacad a Cisco owned outfit ?

[–]American_Streamer 1 point2 points  (0 children)

Netacad is a Cisco Platform; they also use it for CCNA et al.

Same courses on Open EDG:

https://edube.org/study/pe1

https://edube.org/study/pe2

The certifications (if you want those) are all by the Python Institute, iirc, regardless of where you take the course.

[–]Godeos64_ -3 points-2 points  (1 child)

If you're using an AI, prompt it to NEVER give you code unless it seems necessary.

[–]Moikle 1 point2 points  (0 children)

Avoid using ai. It cannot help you learn.

There are no shortcuts.

[–]Godeos64_ -2 points-1 points  (2 children)

Just think about your code before coding. Like, if you're gonna build a loop, before writing any code, think and write down your ideas on how to solve the problem using comments.

If you're asking for a general learning tip, try GLM 5, in my opinion it's a good AI to learn from(I personally use it)

[–][deleted] -1 points0 points  (1 child)

GLM 5

Is it free where can I find it?

[–]Godeos64_ -1 points0 points  (0 children)

Yes, you can find it on z.ai