Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Intuitively understanding Python
#1
I've been learning Python from one of the No Starch Press books. "Python Crash Course" by Eric Matthes. I've started on the first project - an Alien Invasion game. I can copy/paste code from the book and it works fine. He explains how stuff works and I may think I understand how it works at the time but as soon as I go off the rails and try to do my own thing it all falls apart.

I want to put a scrolling star background in the game and I've found tutorials online that explain how to do it, and I have a file that successfully does what I want to do. The problem I'm running into is the book pushes refactorization - splitting up your programs into multiple files. I want to have my scrolling background in a separate file that is accessed by the main program. It goes through how to do this, and I'm trying to do that, and all I get is a giant pile of errors when I run the program. I've spent days trying to figure out the right way to do it, and rewritten my background file multiple times. I just can't do it.

I feel really frustrated because I feel like I can copycat code but don't intuitively understand what it is that I'm typing. I want to become literate in Python, and that means knowing more than just copying code. Is there a resource that teaches Python better than this book does? In a way that helps me understand Python in a more intuitive way so I can code from memory rather than copying from somewhere else?
Quote
#2
I can't offer you much help, but I can say that as a python noob whenever I feel stuck going off rails from tutorials and not understanding the projects I want to make. I always revert back to looking at something I made in the past that worked, and see why that is, and if there is some code somewhere I have made that I can reuse. Also, looking up documentation is a great source of informartion.
Quote
#3
It's a dream of mine to write a program that teaches Python in a Socratic manner, but that hasn't happened yet and isn't likely to soon. So my short answer to your question is no, I don't believe anything like that already exists (and LPTHW isn't it, to preempt anyone potentially suggesting that).

If you're having trouble making changes, you should make posts asking for help here. I'm not into game development, so I won't be of my help for your specific issue, but I believe that you just have to work through it. Get help, and if the help doesn't make sense to just keep asking questions. Eventually it clicks.
Feel like you're not getting the answers you want? Checkout the help/rules for things like what to include/not include in a post, how to use code tags, how to ask smart questions, and more.

Pro-tip - there's an inverse correlation between the number of lines of code posted and my enthusiasm for helping with a question :)
Quote
#4
Python is programming language.

What you have to do to master spoken language? You must learn words and their meaning. You have to differentiate nouns and verbs etc. You have to know how to construct sentences (is noun before or after the verb?). You must understand is it past, present or future tense and so on and on. One will never learn all this without practice. You must practice language in order to master it. You may learn a language for extensive period of time and still feel lost.

At the end of the day programming is an idea in spoken language translated into programming language. Python makes this translation relatively easy, but as with spoken language - if you don't have anything to say then there is nothing to translate.

One way is to spell solution/algorithm in spoken language and then try to translate it into Python.

Problem: keep only even numbers from sequence of numbers.
Solution in spoken language: go through all numbers and check if number is even, if so keep this number.
Solution in Python: try to translate solution in spoken language into Python

One should always have a plan or idea or algorithm what to do in order to achieve desired result. Only after that you can start with how and actual code.
micseydel likes this post
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Understanding Python version releases venami 3 864 Aug-24-2018, 09:56 PM
Last Post: venami

Forum Jump:


Users browsing this thread: 1 Guest(s)