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.

  • RAM_DOS@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    1 year ago

    I’m still learning but what got me hooked (and still hooks me) is finding tasks that I would like to make easier for myself (changing file names, outputting a simple but interesting data analysis to a file), general amusement (creating a list of curse words and the looping through the list and printing f strings with them), visualizing data. Keep it really simple. I would recommend messing around with little projects, googling how to do stuff but absolutely intersperse that with taking the time to learn why things are doing what they are or how they are doing it.

  • 14th_cylon@lemm.ee
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    this might be what you are looking for. you get complete course - lessons, homework, and environment to upload to and evaluate these homeworks. work at your own pace.


    https://pll.harvard.edu/course/cs50-introduction-computer-science

    Course description

    This is CS50x , Harvard University’s introduction to the intellectual enterprises of computer science and the art of programming for majors and non-majors alike, with or without prior programming experience. An entry-level course taught by David J. Malan, CS50x teaches students how to think algorithmically and solve problems efficiently. Topics include abstraction, algorithms, data structures, encapsulation, resource management, security, software engineering, and web development. Languages include C, Python, SQL, and JavaScript plus CSS and HTML. Problem sets inspired by real-world domains of biology, cryptography, finance, forensics, and gaming. The on-campus version of CS50x , CS50, is Harvard’s largest course.

    Students who earn a satisfactory score on 9 problem sets (i.e., programming assignments) and a final project are eligible for a certificate. This is a self-paced course–you may take CS50x on your own schedule.

    • TerribleJokes@lemm.eeOP
      link
      fedilink
      arrow-up
      2
      ·
      1 year ago

      That course looks amazing! I’m definitely going to try to find some time to start that soon and learn a lot more!

  • troye888@lemmy.one
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Back in the day before university (around 6 years ago) I got recommended a mooc(massive open online course) by the university of Helsinki. I used this course to get started with learning to program, and to find out whether it was something for me. It has been some time, and it seems they update the course but I hope it can help you too in learning. Here is the link: https://java-programming.mooc.fi/. It really starts from 0, with setting up te environment which is nice. It is in java using the netbeans ide which some would call antique, but in my opinion that does not really matter to start to learn.

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

    Some of the projects that pushed my own learning were very small things to help my school or work. When I was younger I had to do 100 FOIL equations and show my work. I did not want to do that all by hand and wrote a program to do it. If you got something super repetitive but not super hard, that would be a perfect project.

  • yarn@sopuli.xyz
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    If you’re good with learning via books, then I would recommend Python Crash Course. It assumes you know nothing about programming and has a good reputation as a teaching resource.

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

    All the suggestions here are good for a complete beginner with no knowledge of coding, but I wanted to just add that once you get some experience and are more confident with your google-fu, I would suggest looking at the problem from the other side, and look for things you want to improve in your life first, and find ways to do that with code, rather than the other way around. It will help you stay more engaged with your project, and you’ll retain more knowledge.

    i.e. I hate guessing which parking lots around my school / office / apartment are full every day -> make a web scraper that scrapes parking lot occupancy and compiles it all in one place

    or

    I keep forgetting to water my plants -> hook up a raspberry pi to a solenoid, and code up something to water the plants for you

    I’ve found that to be a much better approach than going the opposite direction

    i.e.

    I need to learn how to write embedded code -> write an Arduino control loop that keeps dog bowl topped up.