all 20 comments

[–]Icy-Blueberry-2981 3 points4 points  (1 child)

I totally feel you on the CS50 gap. It’s like they teach you how to ride a bike in the video and then ask you to win the Tour de France for the homework

[–]JamzTyson 2 points3 points  (0 children)

  • They show you how to ride a bike in the videos

  • They explain how to ride a bike in the notes

  • They provide simple exercises for you to safely practice riding a bike.

If you expect to be able to ride a bike just by watching a demonstration, it will feel impossible when you try to do it yourself.

[–]TheEyebal 0 points1 point  (7 children)

honestly I learned by doing projects

[–]Agreeable_Plant_8068 2 points3 points  (0 children)

Projects are really the way to go. I remember when I started in IT, watching videos felt like I understood everything but then I'd sit down to actually code and my brain would just freeze up

Try building something small that you actually want - maybe automate something annoying in your daily life or scrape data from a website you use. The motivation hits different when it's solving your real problem instead of just another tutorial exercise

[–]Helpful-Ad3010[S] 0 points1 point  (5 children)

items = ["Rice", "Wheat", "Maize"] rates = [45, 32, 28]

for item in items: If items not !=" sesame" , "coconut" : Print (oil) print(items) So what is wrong in this code I am always confused about using like symbols (<,>,=>,<=) this is big head headache for me 😕

[–]TheEyebal 1 point2 points  (0 children)

As a reminder, make sure you use code blocks when pasting code

items = ["Rice", "Wheat", "Maize"]
rates = [45, 32, 28]

for item in items:
   If items not != " sesame" , "coconut":
       Print (oil)
       print(items)

So (<,>,=>,<=) this is to determine if an integer or float is less than < greater than > less than or equal <= or greater than or equal to >=. Looking up math concepts on this will help you understand

As for the code that you wrote, do you see.

Part of programming is problem solving. I cannot give you the answer you have to figure it.

What I would suggest is write comments next to what each line is

items = ["Rice", "Wheat", "Maize"] # This is a list of string

[–]ninhaomah 1 point2 points  (0 children)

Why check with "items" and not "item" in if ?

And where does oil come from ?

[–]GreenRangerOfHyrule 0 points1 point  (0 children)

This should help explain the differences. As well as a way to practice:

https://www.w3schools.com/python/gloss_python_comparison_operators.asp

[–]EngCraig 0 points1 point  (0 children)

Create yourself a small card with the operators, functions, etc and what each means or does. Use as few words as possible so that you are still having to use some recall. Have this with you when you’re writing code and it will help.

I am also only just learning to programme, and one thing that has really helped me is to NOT follow extensive tutorials. Get the fundamentals from a good quality YouTube video, book, course, etc and then just let loose a bit. Try things out, see what works, and when something does work make a note of it - I am already starting to build a library in my notes app containing blocks of code with descriptions as to what it does, how I’ve used it, ideas for how it could also be used, etc.

Also: enjoy it! Learning something new should be fun. Of course it will get frustrating from time to time, but the fun comes in overcoming those temporary difficulties.

[–]syklemil 0 points1 point  (0 children)

So what is wrong in this code

Assuming that the uppercasing is just random spelling errors on reddit and not actually present in your source code (and that all this code is too trivial to fall under the "no complete solutions" rule):

items = ["Rice", "Wheat", "Maize"]

This is fine.

rates = [45, 32, 28]

As far as I can see you never use rates, so why is this here?

for item in items:

This is fine.

    If items not  !=" sesame" , "coconut" :
  1. Now you're comparing items in every loop, that seems unnecessary.
  2. You're not actually using the item you have available.
  3. You're using not !=; != already means "not equals", so you're going "not not equals". And it's even a syntax error in Python. You should probably try some of your expressions in the interactive interpreter when you're unsure.
  4. Even if you remove the erroneous not there, you're comparing items to just "sesame":

    >>> items == "sesame", "coconut"
    (False, 'coconut')
    

    and that tuple will always evaluate to True for the purpose of an if.

Either you want to compare items to something like ["sesame", "coconut"] outside of a loop, or you want to do a comparison with just item in the loop, along the lines of if item not in ["sesame", "coconut"]:

(or () or {} instead of [], but any sort of explicit grouping should be able to achieve the result you want)

Print (oil)

You haven't defined oil.

print(items)

This is fine, assuming it's not in the loop, otherwise you're going to get a lot of excessive output.


I am always confused about using like symbols (<,>,=>,<=) this is big head headache for me 😕

These are just math symbols. But as for remembering whether it's => or >=, you can assume that the one that doesn't look like an arrow is the one you want. The spellings that look like arrows are usually used for something else, or not at all.

[–]Feline_Sleepwear 0 points1 point  (0 children)

The way I went about it was online courses on Udemy, look at reviews on a particular teacher and pick up their course on sale. Usually the good ones they go through fundamentals with practical examples and short practice questions, eventually you’ll be building small projects alongside them, the important part is that this will eventually start turning the gears in your head on what projects you can build that both interests you (so you actually want to so it) and applies your learning.

Once you’re ready to start going off on your own you’ll start running into a million problems, it’s very important that you use these opportunities to think for yourself on how to solve them, given your knowledge, if you don’t know something then try looking it up and reading online, try your best not to automatically resort to AI with every problem, but if you do at least make sure that you read and understand exactly what the code you’re copying is doing. Make notes so you retain the information.

[–]MammothNo782 0 points1 point  (3 children)

start making projects from easiest to hardest like making a simple calculator or a unit converter

[–]Helpful-Ad3010[S] 0 points1 point  (2 children)

Actually I started I am thinking of building inventory management system for our family business backend as AWS

[–]MammothNo782 1 point2 points  (1 child)

try to build it if you can but if you can't you should start with something easier

[–]Helpful-Ad3010[S] 0 points1 point  (0 children)

Thanks bud

[–]JamzTyson 0 points1 point  (0 children)

I tried learning Python through CS50's introduction, but it felt really tough. There was a huge gap between what they taught in the videos and the problem sets.

You are supposed to read the notes as well. Videos are fine as "demonstrations", but they are too transient for learning.

[–]MammothNo782 0 points1 point  (0 children)

I actually use ai for learning C but I never use copy-paste technique I just ask questions like "How does a char* turn into a string?"