I have a feeling I’m stuck in tutorial hell, and I need to start actually building things. But I don’t know where to start :/

Also I’m really bad at syntax. I only know concepts like for loops, while loops, if-elif-elses, etc…

So maybe something that helps me learn more about coding syntax would be helpful.

Thanks!

  • AstroLightz@lemmy.world
    link
    fedilink
    arrow-up
    7
    ·
    1 month ago
    def main():
        print("Hello world")
    
    if __name__ == "__main__":
        main()
    

    /s

    I think a small one I worked on was extracting URLs from a CSV file in a certain column. Not too difficult, but a very specific use case.

  • Cryxtalix@programming.dev
    link
    fedilink
    arrow-up
    6
    ·
    1 month ago

    Do your todo apps, sudoku solver etc. Simple problems are fine. Don’t look down on them, don’t tell yourself that they’re too simple for you. There is always more complexity that you first expect once you start tackling it seriously.

    Also, every self respecting tutorial ought to have exercises after every chapter. Don’t skip them either.

  • thingsiplay@lemmy.ml
    link
    fedilink
    arrow-up
    5
    ·
    1 month ago

    I can’t answer your question in the title, but I can say what I do whenever I learn a new programming language (even if its temporary just to play around with new languages). My personal Hello-World like program I tackle in most cases is something that runs another program. Lot of my personal projects are actually like that. You can start simple, to learn how to do associated tasks with it. There is a lot you can learn by diving into this (first) simple exercise.

    This will help you understanding how to read directories, handle file names and paths correctly, read text files in example, how to spawn a process, handle possible errors and react to error codes, possibly read and process stdout of the program. Also handle commandline options, output stdout so it can be used with other programs easily. Write configuration file and so on.

    An alternative thing you can try is, doing a simple grep like program. Or maybe a simple game that asks you a few questions and gives points. Or a note taking app.

  • crunchpaste@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 month ago

    One of the first small projects I worked on when i was starting with python was a telegram birthday reminder bot as i really didn’t want to rely on Facebook for that. At first I was just looping over all the entries in a list, then went to a database, at some point added fuzzy search, adding and removing entries. Still use it today.

    Imo the best way to learn is to think of a project that you personally find useful and need solved for yourself, not some abstract exercise.

  • bobo@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    1 month ago

    A bit offtopic, but it’s relevant.

    My first attempt to learn to code was more than a decade ago with python. I went through the basics, and decided to start a small project to practice. At the time python didn’t really have too many applications apart from automating tasks (before Hugo, flask, etc), so what did I think up? To make an automated propositional logic theorem prover. You input a formula, it tells you whether it’s a tautology or not.

    Great idea, there are some relatively simple algorithms we’ve learned for pen and paper, it doesn’t seem too hard, etc. After a month I learned that it’s an extremely complex problem with billions invested in solving it because it’s directly relevant to PCB manufacturing.

    That attempt failed horribly, and it took me a few more years and attempts before I found a good method. Web dev was actually crucial because I had direct feedback on simple logic.

    So if you’re anything like me, make a blog from scratch or something else that’s actually simple, but gives you immediate visual feedback. And just to be clear, I ended up absolutely hating frontend, but it was a great stepping stone.

  • NewDawnOwl@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    1 month ago

    Maybe try it from the other way around : look for tutorials that help you achieve your goals, and contextualise the tutorial to your project.

    I am wrapping up the Django tutorial because I needed to make a database that held the information on where I put my taxes instead of just ramming them in the downloads folder. I just followed the django tutorial on the official website, but changed variable names etc to make it suit my needs.

    I’m also working on improving my bash skills. I made a clock chime to learn cases :

    https://lemmy.world/post/43115099

  • Fargeol@lemmy.world
    link
    fedilink
    arrow-up
    4
    ·
    1 month ago

    It was a tiny TicTacToe server I made to learn machine learning. I basically played TTT against it and it would train on the former games to improve. It didn’t work since I’m not a data scientist, but at least I know how to create Web Sockets!

    I can give you a few advice if you want

    • Single Responsibility Principle: don’t do everything in the same place, separate between functions, classes or files. In my server, one file contained anything related to the server, another anything related to game logic and another anything related to machine learning.
    • Don’t reinvent the wheel: unless you’re making it as an exercice, don’t create something that already exist as a library. Python is wonderful for its libraries
    • Don’t optimize stuff: if you feel that “it could be faster”, either benchmark it or give up. “Premature optimization is the root of all evil”
    • Learn how to make useful naming, tests and documentation: this is not something developers like to do but you’ll love yourself if you read your code after a few months
    • Don’t code with an AI: If you’re bad without an AI, you’ll be bad with it. If you’re good with an AI, you’ll be good without it. You can still ask one for snippets or use it as a tool to discover concepts you don’t know about but I strongly advice against autocomplete and coding agents (I talk from experience).

    If you don’t know how to start, you can make a really simple Tic Tac Toe game with its rules and play it in a CLI. Then you can decide how to pimp it: a better interface, game saves, an opponent played by the computer, a game server for a multiplayer game… you decide!

  • Caveman@lemmy.world
    link
    fedilink
    arrow-up
    3
    ·
    1 month ago

    For basic mechanics it’s really good to start with a text based tic tac toe.

    It forces you to use for loops, read from input, parse, arrays, small amount of state, rendering said state and conditionals.

    To go the extra mile try to make it look tidy. This can be done by using a class to represent a state and having single purpose functions.

  • chicken@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    3
    ·
    1 month ago

    I made one to track volume of keypresses per hour, and draw a graph comparing how much typing I’ve been doing on the current day vs an aggregated average

  • Slatlun@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    1 month ago

    A small script to append some characters to a string based on whether the letters in the file name were capitalized. Super simple, but I had a data migration project to a system that doesn’t recognize case and people before me coded information into case. It is essentially tutorial level but real life application. Maybe you have something similar? Practical and working before anything complex.

  • jtrek@startrek.website
    link
    fedilink
    arrow-up
    3
    ·
    1 month ago

    I did some webdriver stuff for reasons I don’t remember anymore.

    I also made a simple Django app to track job applications.

    Unsolicited advice:

    • use type annotations. You’ll thank yourself later when your IDE tells you “hey this can be None are you sure you want to call .some_func() on it?”
    • use an ide. Don’t just raw dog it in notepad. You should have syntax highlighting, red squiggles for errors, the ability to go to definition.
    • learn to use a debugger. Pdb is built in and fine.
    • don’t write mega functions that do a thousand things. Split things up into smaller steps.
    • avoid side effects. You don’t want your “say_hello” function to also turn on the lights
  • Von_Broheim@programming.dev
    link
    fedilink
    arrow-up
    2
    ·
    28 days ago

    I wanted to use TheFuck on latest Linux Mint so I had to download the source and make some upgrades to make it work.

    Another small project was a small app for extracting file differences between two folders, the idea was that I can mod games in windows, make a diff between vanilla and modded versions, then copy the diff onto my Linux machine and extract it into the game root installed there. Works great.

  • sicktriple@lemmy.ml
    link
    fedilink
    arrow-up
    2
    ·
    1 month ago

    Check out pi pico and hardware/microprocessor programming. I found it easier to wrap my head around certain concepts when I had a practical application for them right in front of me.

  • gsv@programming.dev
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 month ago

    The only thing that really got me going was small applications I had some interest in. Writing games I will not play never kept my interest up for long. So I’ve been building mini tools I used for teaching numerics classes in meteorology (Python, Julia, Fortran, C) or code I would be using for some tinkering with microcontrollers or similar (Python, C++) when using new languages. For me personally, some iconic projects were a CO2 sensor with an attached display, or very simple internal gravity wave ray tracers. But that’s likely not what you’d be interested in. So without trying to suggest specific applications for you (many good examples in the responses :-) I’d advise to do something you’ll have fun with. Get yourself a small project that generates added value for you specifically (and fun is great added value in my eyes).