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?

  • blankmind@lemmy.world
    link
    fedilink
    arrow-up
    17
    ·
    1 year ago
    • 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.

    • James@lemmy.ca
      link
      fedilink
      arrow-up
      5
      ·
      1 year ago

      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.

    • groucho@lemmy.sdf.org
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      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…)

    • slazer2au@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      This is a good start.

      My latest python script loads my monthly banking CSV, arranges the columns in the correct order, assigns categories based on the merchant, and finally exports the data to a new CSV.