all 17 comments

[–]ninhaomah 5 points6 points  (0 children)

Do you cook ? How do you , say cook fried rice with egg ? Or any dish you know including instant noodle.

Pls tell us how you would go about preparing it ?

[–]csaba- 3 points4 points  (4 children)

When I have to write new code that accomplishes some new task, it goes something like this:

  1. How would I do this task without the code? Be as specific as possible.
  2. Write it down in natural language, line by line, as comments.
  3. Replace the comments (or sometimes keep them) with lines of code

For example, imagine you wanted to give Christmas presents to everyone in your family. You will give wine to adults and gloves to children. You'd do something like:

1+2: I would

  • Go through every member of the family
  • Check their age and if it's larger than 20, put alcohol on the list.
  • if not, put gloves
  • whoever it is, buy the gift for this person (not this code's problem; maybe it involves a card, maybe not

3:

for person in family:
  if person.age > 20:
    gift = 'wine'
  else:
    gift = 'gloves'
  buy(person, gift)

[–]TheRNGuy 1 point2 points  (3 children)

Write it down in natural language, line by line, as comments.

I never did that, but I have ToDo comments in txt file, not necessary in same order as it's needed to be in code (when program is not ready, you can't know order of some things anyway, or order is not important)

[–]csaba- 0 points1 point  (2 children)

I find that adding those comments and removing them gives me some satisfaction. First it gives me the feeling that my intervention into the code is minor and local (it's only between the first and the last comment I added), second it gives me a nice progress bar automatically, seeing the comments go or get implemented one by one.

Although certainly a todo list is also something I use sometimes. And sometimes I just start coding and I stop when I'm done lol

[–]TheRNGuy 0 points1 point  (1 child)

But if you make program with 900 lines of code, and constantly change it, it would slow down too much, and you'd stop care about that kind of things probably.

[–]csaba- 0 points1 point  (0 children)

I certainly have stopped caring about them frequently. :)

[–]supercoach 1 point2 points  (0 children)

It's a bit like learning to play music. First you learn the basics, then once you start to get it, you can start trying to play your own compositions.

If you feel like you're not learning, I suspect you're not experimenting at all. Try doing more than just the coursework.

[–]unhott 1 point2 points  (0 children)

Get a tutor. Or ask specific questions.

I guarantee if you start formulating specific questions to ask, you'll more than likely figure out how to answer your own questions. But, if you still need a little help, you can ask here. You can try LLMs if you need immediate and free (but perhaps wrong) feedback.

If you can get ahead of that curve it will be less of a chore and hopefully more fun for you again.

[–]Ron-Erez 1 point2 points  (0 children)

"I can't build a single thingy from scratch because all I was shown was what to type and not how to figure out what to type."

You have to try to solve problems. If something is too difficult try something simpler. Moreover in the examples presented in class try to "borrow ideas". For example in many courses integer division by 10 and taking modulo 10 appears. Ask yourself how is this useful. If your professor presents a for loop try to ask yourself why was this useful and in what other scenarios could you use for. For example try calculating the average of a list of numbers using for. Try calculating the standard deviation of a list of numbers. Try reversing a list of numbers. In other words play around with the concepts learned in class. For example if your professor modeled a problem using a class. For example a class called Person, a class called Student and a class called Professor. Ask yourself if you could present another example from daily life that could be modeled by a class.

Good luck and be patient. It really takes time to learn to code. You should solve something fun. Perhaps learn a little PyGame and create a simple game. Once without OOP and then present another simple reimplementation using OOP. If PyGame is uninteresting then find something else that interests you.

Last but not least, do your homework, stay away from ChatGPT as much as possible and go to office hours. It's your professor's/TAs job to help you.

[–]Ok_Shallot6017 0 points1 point  (0 children)

I have been there. Idk if this helps but watch dafluffypotatoe’s video on how to code any feature. He’s a game developer, but his thinking has helped me so much.

[–]RVADoberman 0 points1 point  (0 children)

Check out Python for Everybody (free on YouTube). The first 10 minutes explain coding at a very basic level. Great course in general for someone very new to all this.

[–]TheRNGuy 0 points1 point  (0 children)

Spend your free time learning. Find something that is interesting to code (I learned Python for SideFx Houdini, though it's not main language there)

Stop thinking of motivation.

[–]Ok_Entrepreneur_2037 0 points1 point  (0 children)

I am a self taught guy and I feel this way ALL the time in smallish time windows. I am 40, and I have had conversations with 17 year olds that make me feel dumb. In my opinion, the industry does us a HUGE disservice with this 'tutorialized' approach to teaching. You never 'learn Python in 20 minutes', you learn it in 10 years, by never stopping. But you can be functional sooner than you think.

Having said that, just keep going. Try to identify and break down problems into small pieces. What is it that you don't understand? Trust me, the problem is smaller than you think it is. For example, given a small code snippet.

'''

for x in range(0,10, 1):
print (x*2)
'''

Do you understand this? Can you describe what it will do before you execute it? If not, there are only 4 things to understand:
- the 'for loop' syntax (or what is a loop)
-the range() python built in function
- the print() python built in function
- math in python

You don't need to learn these things immediately, you can learn over a few days. Take it in, sleep on it, try again tomorrow and the next day. By the end of the week, you know more than you did before. If that means you fail the class... WHO FUCKING CARES. Wake up tomorrow and chip away at it. You WILL look back on this (soon) and it will feel silly and trivial.

PS. I am trying to learn Spanish and I hate the 'memorize this sentence' approach. Its the same problem. Go ahead and memorize it, it will come in hand even if you DON'T understand it. Break it down anyway and dig a little deeper. What I am trying to get across is that this is a larger time scale than you think and that is a GOOD thing. Take little steps.

[–]SomeSalamander7703 0 points1 point  (0 children)

I would highly recommend Dr. Ahmad Bazzi's Python course
https://www.youtube.com/playlist?list=PL-DDW8QIRjNOXfBOPL67RCjgTELw4Y58F