PDA

View Full Version : A guide to coding for a complete beginner.



The Pale King
2009-12-21, 08:59 PM
Lately, I've been thinking about getting into computer coding. Could someone give me an online beginner's guide to coding to help me learn. Something to help me start. Preferablely as basic and user-friendly as possible.

Lifeson
2009-12-21, 09:29 PM
In my programming class, we started out with Turing (http://en.wikipedia.org/wiki/Turing_(programming_language)), which is a very simplified Perl/Pascal descendant that's very easy to read and comprehend. You could do some very interesting things with it.

Decoy Lockbox
2009-12-22, 01:36 AM
Lately, I've been thinking about getting into computer coding. Could someone give me an online beginner's guide to coding to help me learn. Something to help me start. Preferablely as basic and user-friendly as possible.

If you ever want to, most college computer science departments put up their slides and projects for public access online, which basically lets people take college-level programming courses for free. Since these run the gamut in terms of difficulty, you could always grab a beginner level one and just dive in. I think my school just changed their early-level curriculum to be python, and I've heard that this is a good starter language. Here (http://www.cs.umbc.edu/201/fall09/schedule.shtml) are the lecture slides, and here (http://www.cs.umbc.edu/201/fall09/assignments.shtml) are the various assignments and practice problems.

I started with c++ and Java myself, and let me tell you, "computer science I for majors" was much harder when took in 5 years ago, and it was taught in C instead of python! These kids don't even have to worry about allocating their own memory these days...

Tirian
2009-12-22, 12:54 PM
Python is a good starter language, as suggested. You can download (http://www.python.org/download/) some version of it (I use ActiveState's myself, but they're probably all fine). And then pick up the language by Googling "python beginner tutorial" and following any of the zillion links until you find one that talks to you at your level.

If you want something that is even more newbie-friendly to the point of being nearly childish, I'm also a fan of Scratch (http://scratch.mit.edu/). It has a neat interface for keeping you from making spelling mistakes and similar sorts of syntax errors, and has particularly easy access to drawing things and making sounds and recognizing mouse clicks that makes it a very natural sandbox for intuitive self-exploration. It's harder to do things outside that sandbox, though, but by the time you've grown that much you'd be able to apply what you've learned to Python or any other language.

The Pale King
2009-12-22, 07:13 PM
Thanks to the guys who gave my Phython. I've just started the basic stuff but it seems pretty intuitive.

But I have one question. On the tutorial I did, I this filled it out exactly as they said to (keep in mind I'm on about the third section)


number = float(input("Type in a number: "))
integer = int(input("Type in an integer: "))
text = input("Type in a string: ")
print("number =", number)
print("number is a", type(number))
print("number * 2 =", number * 2)
print("integer =", integer)
print("integer is a", type(integer))
print("integer * 2 =", integer * 2)
print("text =", text)
print("text is a", type(text))
print("text * 2 =", text * 2)

It said that this should have gotten out:

Type in a number: 12.34
Type in an integer: -3
Type in a string: Hello
number = 12.34
number is a <class 'float'>
number * 2 = 24.68
integer = -3
integer is a <class 'int'>
integer * 2 = -6
text = Hello
text is a <class 'str'>
text * 2 = HelloHello

But it won't run it. It says that one of the prints is "invalid syntax". What does that even mean?

EDIT: Nevermind. I resolved it. Just one or two stupid mistakes.

Douglas
2009-12-22, 07:32 PM
Which version of python are you using? It appears the tutorial you're using is for version 3.something. If you're running python 2.x, that would explain your problem.

"Invalid syntax" is an extremely generic error message that means something on that line does not make sense in the language. If that's really all it says, I'd be surprised. I haven't actually used python myself, but my experience with other languages is that error messages like that almost always include something to indicate what, exactly, is wrong.

The Pale King
2009-12-22, 09:55 PM
No. The language I downloaded was Python 3.0, and that was all it said. I'm just using IDLE, so could that explain the problem?

Tirian
2009-12-22, 10:51 PM
Hmmm. I just pasted that script into my IDLE (although I'm running Python 2.6, so I am not a completely dependable source), and it asked me for the three values and then crashed before running the print commands. If that is your situation, then you might want to try inputting the strings with quotation marks. For instance, you want to enter "Hello" or 'Hello' instead of Hello.

If that doesn't help, then there's something stranger going on with the input statement. It's funny, but I've actually never used that command before in Python.

Thajocoth
2009-12-23, 03:36 AM
I recommend selecting your first language based on what you ultimately want to do. Just like with spoken languages, the first one you learn is what you'll likely wind up thinking in, no matter how many more you learn. My expertise being video games, I can certainly tell you that the C family of languages (C/C++/C#) is what a video game programmer needs to know above all else. Because the university I went to was receiving money from several companies that worked on cell phone apps, I also know that Java is used for anything on a cell phone. I don't know anything about Python. The people I've known that liked it seemed to be more open-source minded.

My first language was QBasic. It's a very simple, easy language to learn, which you can't really do a lot with (easiness to learn and what you can do with a language are usually inversely proportional. That is, as one goes up, the other tends to go down... Usually.) QBasic, however, doesn't really seem to take hold as one's primary language. It's more of a stepping stone to learn other functional languages. Kinda like taking a linguistics course in a certain subset of spoken languages... It helps you learn them later, but is purely academic.

Functional languages are the type that I use. You make classes and functions (or methods, there is a subtle difference), and they run sequentially as they're called. This is fairly straightforward, but can be complicated with threads and function pointers, events and all sorts of fun things to provide one with hours of bug-tracking. There are some types of languages that are better for manipulating logic, or that can be run both forwards and in reverse. I think a company actually made a commercial video game in a logic language once...

I made a set of QBasic tutorial files. 51 files in 5 chapters. Each chapter is 9 lessons, each on something specific and somehow related to one another, and a test. The last file is a final. My lessons and tests are flawed though, as they're too open ended. After explaining how to do whatever it is, I merely say to use that concept to write something that compiles, instead of giving any specific assignments or examples. But I was in middle school at the time, and I'm not gonna go back and fix something no one's ever gonna use.

Anyway... Best of luck to you. Hopefully you'll enjoy writing code as much as I do!

The Pale King
2009-12-23, 03:28 PM
OK. It keeps saying that I have invalid syntax and then it highlights the fifth print. I have no idea why it keeps saying that this is wrong. Can anyone tell me. I'm using Python 3.1.1 and IDLE 3.1.1