What is the issues?

    • @[email protected]
      link
      fedilink
      English
      1
      edit-2
      1 year ago

      I first learned Python from a book called Python for Kids by Jason R. Briggs. Quite a good reference for beginners, children or not. It walks you through everything from installing the Python interpreter and your first “Hello, world!” , through data types, functions, classes and Python’s object-oriented programming (OOP) features, through to making a simple graphical platformer game. I received a copy of that book for my 12th birthday and read it cover to cover, following every example. Once I had a solid grasp on how Python itself worked, I started reading the standard library documentation at docs.python.org/3/ to find out how much the programming language I had just learned could really do (and how I could make it do it). By the time I was 13 I was programming my own multiplayer, multi-computer games from scratch. (Mind you, they were text based – the book showed how to make a graphical game, and I had done it once, but I didn’t have the patience to do it again :P)

      I’ve also heard good things about Al Sweigart’s books, which have the advantage of being available free of charge on the author’s website; however I find they largely ignore Python’s OOP features and do many things most Pythonistas consider to be anti-patterns (fancy word for ways of doing something that work but are suboptimal in some way, usually because there’s an easier and/or less error-prone way of doing them). If you want to get straight into practical applications of Python, I can think of worse ways to start, but if you do I would definitely recommend reading up on how classes work on your own time. Python’s OOP features are one of the primary reasons to choose that language over others, and Sweigart misses out on a lot by not even mentioning they exist.

      One other note: It’s okay to ask ChatGPT how to do something or what to do in a situation you’re not sure about, but I would strongly discourage you from asking it to write the code for you and simply copy pasting what you’re given. You’ll never learn to program if you don’t take the time to understand why things work the way they do and how to write a program without the computer’s help. That’s not to say you have to memorize everything, mind you, or that IDEs like PyCharm that have linters (a component that provides a red squiggly underline when you call a function you forgot to define, or spelled a variable name two different ways in two different places) are for babies – it’s been close to a decade since I got that book, I’m a programmer full time now, and I still look up documentation every day, even for built-in functions I’ve used dozens of times before, and I can scarcely write a program without my linter checking I’ve spelled all the function names correctly – but I don’t go to ChatGPT or StackOverflow, take code someone else has written, and treat it like magic. I read what the functions do and what arguments they take and write the program myself.

      That’s not to say all copying of code is evil. I think it’s fine in moderation. The important thing is to understand what exactly the bit you’ve pasted does and how you would change it, if you wanted to, to make it do something else. Say I’m learning HTML and I find online that adding background: #FF0000 to my CSS makes the background of my page red. This tells me nothing about what I’d need to know if I wanted to make it blue. I could look that up separately, of course, but I’d much rather understand what that mysterious code does and be able to make my own without help from the internet. If I do a bit more googling, I find out that that six-digit number is split up into three parts; the first two digits are how much red is in the color, the second two are green, and the third two are blue, each ranging from 00 (black) to FF (full saturation). Then I can reason out that #FFFF00 would give me full red, full green, and no blue, which would mix to make yellow. If that’s all I need to know, and I’m satisfied, I can stop there. If I’m still curious, I can keep researching and learn how hexadecimal works to represent a number between 0 and 255 in two digits using base 16. That thirst for knowledge, always wanting to know a little more than I strictly have to to get my job done, has gotten me very far in life, and I suspect it will do the same for you.

      Sorry for the wall of text. It’s late and I’m on mobile so I tend to ramble. Hope this all made sense :)