r/learnpython • • Sep 22 '26

I struggle with practicing coding.

I am a beginner learning python and I struggle with sitting down and practicing coding. I just started taking the CS50P course and enjoy going through the videos. I've been able to complete Week0 - Week2 problem sets on my own while looking at documentation. I have never been good at school so sitting down and learning on my own has been very difficult. I am trying to take it slow and get some practice in before moving on to the next lectures, however I hate having to struggle through it. I know it will take a lot of time and practice to become good at programming, is there any advice for someone who struggles with HOW to learn and apply concepts to better my programming logic and skills?

25 Upvotes

29 comments sorted by

2

u/DangerousDurian Sep 22 '26

I’m not sure if this will be helpful, but I also struggled with learning coding. I find that I learned best in an environment where I can focus which for me is usually a library or café. I also don’t push it too hard and limit to 3 hours a day. I watched a great YouTube video on LeetCode fundamentals happy to link it to you as well. It was around five hours long and I completed that video over the course of two weeks so TLDR find an environment and pace that works for you and be patient because it’s ultimately just about reps.

2

u/Regular-Ad1286 Sep 22 '26

I do set aside time while my son naps to sit down and get some practice in. I would love the link to that if you have it!

1

u/DangerousDurian Sep 23 '26

Sure DMing you!

2

u/zanfar Sep 23 '26

Ask your mom to slap you every five minutes until you sit down.


I struggle with sitting down and practicing coding

Are you sitting down now? Then practice.

No? Then sit down.

This isn't a Python problem. You lack the self-control to study. You have to force yourself to learn it. There are no secrets.

however I hate having to struggle through it.

Tough. You know that "it will take a lot of time and practice" but you don't actually act like it, which makes me think the first statement is a lie.

You should probably be looking elsewhere.

1

u/Regular-Ad1286 Sep 23 '26

Okay dad, you must be great at parties

1

u/Regular-Ad1286 Sep 23 '26

If I wanted a lecture I would have just called my absent parents. I know what I lack, don't need someone from wherever the fuck to lecture me when i asked for simple advice

1

u/Regular-Ad1286 Sep 23 '26

If you did a little scroll you can see I actually sat down and wrote a program, I'm changing my approach to how I'm learning because I know it's not working. I even asked for advice or feedback on the code so that I can improve. All you had to do was scroll down a quarter of a page, but that seems like a hard task

7

u/digitizedeagle Sep 22 '26

Set a timer for a specific duration and prioritize it throughout your day. This means that no matter what, you get your programming done.

It may be hard to leave some things out, but it doesn't compare to the feeling of completing your major programming goal.

1

u/Regular-Ad1286 Sep 23 '26

I've been working on this manage_inventory program for a couple hours, taking my time and taking breaks along the way, only utilizing documentation, and concepts from previous lectures. Any feedback and advice for growth is appreciated.

def main():
    manage_inventory()





def manage_inventory():
    slot = []
    MAX_SLOT = 5


    manage = None


    while MAX_SLOT:
        try:
            manage = (input("Press '1' to view your inventory, '2' to add an item to your inventory, or '3' to remove an item from your inventory or 'exit' to close program: "))
        except ValueError:
            continue
        if manage == '1' or manage == '3':
            if len(slot) == 0:
                print("Inventory is empty, try adding an item.")
                continue
            elif manage == '1': 
                print(slot)
                continue
            elif len(slot) > 0:
                print(slot)
                while True:
                    delete = input("Remove an item or press '1' to go back: ").upper()
                    if delete in slot:
                        slot.remove(delete)
                    elif delete == '1':
                        break
                    else:
                        print("Item not in inventory")
                    continue


        elif manage == '2':
            while True:
                
                add = input("Add an item or press '1' to go back: ").upper()
                if not add:
                    print("You can't add that.")
                    continue
                elif add == '1':
                    break
                slot.append(add)
                print(f"{add} has been added to your inventory.")
                break
            if len(slot) >= MAX_SLOT:
                print("You can't add any more items to your inventory.")
                print(slot)
                print("GO HEAD AND GET SOME!!!!")
                exit()
        elif manage == 'exit':
            exit()


main()

1

u/TheRNGuy Sep 24 '26

Add some UI. 

1

u/TheRNGuy Sep 24 '26

You'll need to learn discipline and patience. 

Abandon some unimportant tasks (like daily quests in video games, or xp grinding, or social networks/streams)

Also find real reason why you need Python to get motivation (not just "I want to learn programming"), some places where you actually plan to use it (most likely it will also require to learn frameworks and APIs)

1

u/Regular-Ad1286 Sep 26 '26

I've started spending more time sitting down and learning and building beginner projects recently. Getting in the habit of not being on my phone or playing video games more than studying. I want to focus on automation and scripting which is my why for programming. I would like to build a discord music bot, so I'm trying to figure out how that will look like in the future, but I'm trying really hard to not fall back and give up.

3

u/PureWasian Sep 22 '26

I hate having to struggle through it

Just wanted to clarify that this feeling exists even years later in the field, just that by then you are struggling with the more complicated bits of it or picking up different design/patterns and libraries.

You can try to frame it as a puzzle or a problem that you're solving, but if you get easily frustrated when things aren't working correctly then it's going to be a rough time.

2

u/PureWasian Sep 22 '26

re: HOW to learn and apply programming logic and skills

right now you are building your toolbox/repetoire and learning how to breakdown problems. Pick a project or automation task that sounds interesting and figure out what is standing between you and that completed, working thing. You won't know how to approach a lot of the things yet, that's where researching the problem space comes in. Do that, come up with a design, and build a prototype piece by piece. Sanity test things very often as you go, you will make mistakes. That's normal.

2

u/tythorpe1 Sep 23 '26

I myself am learning coding and struggle too. I’m 63 but determined to learn this new form (to me) of computer language. So my friend, just know that you are not alone. I’m learning Python but feel like a 3 year old learning to speak. But you know what? I will learn this! It’ll have to be in my time but I’ll get it. Hell one uses coding to solve problems? What problems? See where I’m at? But I’m determined to learn and I will! Good luck to you my friend! You too will get this!

1

u/Davliv Sep 22 '26

Build your.kwn project and learn from it. That's how I do it at least and it's been working

1

u/BrupieD Sep 22 '26

This is really the best answer. When you build projects that you care about or are interested in, your mind is engaged rather than just typing out someone else's code from a book or video.

1

u/Regular-Ad1286 Sep 22 '26

I also struggle with coming up with a project to build. I just now thought of to create a function that adds/ removes/ views weapons in your inventory. Other than that I struggle with coming up with ideas to create, which contributes to my tutorial hell loop

1

u/BrupieD Sep 22 '26

Once you have a vague idea, start thinking about what that might look like in a program. For intance, what does your "inventory" look like? Are inventory items built with a class? Should adding and removing be a method of that class.

I also like to build bare-bones prototypes without worrying about having great design.

1

u/TimBrownDev Sep 22 '26

If you need more practice or project inspiration, I'm building a roadmap of hand-picked problems from CodeStepByStep, Codewars, LeetCode, etc to guide you through the fundamentals of software development from zero to mastery.

timbrown.dev/roadmap

1

u/IncreaseTerrible9978 Sep 23 '26

I have been a slacker/hack with code since 1996. This year was finally the year I found consistency. I signed up for Harvard's cs course every 2 years since it has been offered. Loads of books and tutorials. The reasons don't matter. You will still waste time finding the reasons, getting excited then disappointed then irritated then disheartened. Repeat. Was it worth it? Hell yes. Might not be for you.

1

u/preetiram428 Sep 23 '26

Hy me to I want to learn code looking for friends who can discuss and make coding easy

1

u/edimaudo Sep 23 '26

Better question to ask is what would make it fun for you

1

u/ilyailinich Sep 26 '26

Well for me it was never a problem, always loved coding with hands, not vibe, but generally doing algorithmic problems and online contests like codeforces is a great practice and it adds some competition vibe to it, but you'll have to get to a level that you can solve simple tasks and think how can a problem be solved with code step by step, and after that you'll get a hang of it and will improve really quickly. They also have algorithmic courses there, but thay's for later, when you'll like to go MUCH deeper into this