I’ve been wanting to learn how to code for a while so I figure now is as good a time as any to start. I downloaded VS code on my laptop for python but I don’t really know end product I should try to code and I also am just bad and barely know what I’m doing. Does anyone here have any advice on what to code and how best to learn?
- Hello World
- Read a file
- Write a file
- Read a file and loop through it line by line, printing each one (for loop or equivalent)
- Program that consists of 2 or more source files
What I’m getting at is instead of a full program, write code snippets and small programs. In doing this eventually an idea for something larger will pop into your head.
Yep! And then read argv for command-line parameters + a parser. File IO + command-line controls gets you a shell of a utility to work with. Then grab a package you like the look, bring it into your project, and do something with it (image manipulation, network stuff, whatever…)
In addition to what this guy said, don’t just use libraries to skip steps when writing small programs.
For example when parsing a file you will often use the split and strip functions in python, but learning how to implement these by yourself will teach you more.
To really learn fundamentals you should try and implement most operations yourself. It’s why in my opinion C is a better language to start with, because it forces you to learn the fundamentals.
I’d say it depends on the learning style. For some people, it’s a lot less demotivating to start as just plumbing libraries together to get the end result than starting from the deep end. Same debate as starting with ASM vs starting with Python.
I see your point, but I would almost argue that starting out with all these shortcuts available in high level languages is ‘jumping into the deep end’ itself.
When a newbie sees obscure error messages in some of these libraries they might not have any idea what they mean or why they were triggered. My opinion is that having a smaller set of tools to start is actually simpler despite being able to do less with them.
I’m slightly biased because I started with C 😅
I agree with this comment. Get these down then you can check this out
When I’m learning a new language I like to try and solve problems from sites like https://adventofcode.com/ or https://projecteuler.net/ I find this gives my learning more of a focus. After you’ve done a few of these you should have enough confidence to attempt your own projects