Ετικέτες

Κυριακή 20 Οκτωβρίου 2013

Beginner's Python Tutorial Part 1: The Basics of Programming

1. Why should I care?
If you've just started learning programming, this question would naturally arise:
Is it worth it? Why should I care about programming at all? What's so special about it? Well, living in a world dominated by computers, programming will become as important as writing! These days, not only programmers need to know how to program, but others as well, scientists for example. Also, the need for good programmers is ever growing. Hundreds of thousands of jobs await for someone to take them.

2. Why read this tutorial? Why not buy a book or something?
If you want to learn something, you buy a book, right? And now that you want to learn how to program, the first thing you should do is to buy a huge tome like "Learning Python" and start reading it until you finish it whole... NO! There's nothing wrong with "Learning Python", it's a great book, but it has 1600 pages!
That's not the way to learn a language and you shouldn't waste money on such books. Let me tell you a secret, come closer so that I can whisper it in you ear:
To learn to program, you have to actually program! Just learn the basics from a tutorial like this and of you go. Read code, write code, think code. Search for a quicker way to achieve something, ask questions, experiment, be curious. Believe me, I tried reading a book but it wasn't worth my time. I simply read some tutorials and then started making programs like simple command-line games, a programs that calculates the decimal digits of Pi, after some more experimenting I tried to create a GUI and after some months a full-scale program to help my father with his work!
So, keep your money for other kind of programming books, books that instead of teaching you a language and a thousand details that you simply don't care about they show you techniques and algoriths, books that teach you how to THINK LIKE A PROGRAMMER!

3.Why Python and not an other language?
As I said before, Python is a great language to start with, both powerful and simple.
Also, it's widely used, so you may find a job with it! (I think that studios like Pixar and DreamWorks ask for Python-consultants!)

4. What is programming?
Programming is the act of writing code that the computer can run. The computer's language is the binary-code, 0s and 1s, but instead of writing in this language, programmers use higher-level languages like Python, C , C++, Java etc. This way, they can write code that they can easily understand, which will later be translated into binary-code using a compiler or interprenter.

5. Compilers and Interprenters? What are these?
These two are special programs that check the programmer's code for errors and then translate it into binary-code. Their difference is that while a compilers translates the whole program into an executable, an interprenter translates the program line-by-line and runs it. This means that while compilers create faster programs, it's easier to use an interprenter as the program will open-up faster.

6. What kind of errors can a program produce?
There are three kinds of errors:
  • Syntax errors: they occure when there is a problem with the programs syntax, a mispelled word for example.
  • Logical errors: there's no error message, everything is right with the syntax, but the program doesn't do what you wanted it to do because you gave it the wrong instructions.
  • Run-time errors: little bastards, they don't show up immediately, you have to do something unexpected while you use your program to trigger them, only way to avoid them is through extensive testing of your program. 

7. So, what is Python?
Python is a general-purpose high-level programming language, which means that that it can be used for a wide-range of purposes and that it is quite simple and has similarities with normal languages. It also enables Object-Oriented_Programming, which is a way of building a program that you should just know its name for the time being. It was created by Guido van Rossum and no, it has nothing to do with snakes, as it's name come from the "Monty Python's Flying Circus" a series that Guido liked (if I ever create a programming language, I will name it Doctor...). It can be used across all platforms (Linux and the other two...) with little or no changes and it uses an interprenter.


Welcome to my Blog!

Welcome to the Bored_Student Blog!
OK, maybe it doesn't sound as I thought it would, but anyway, what I actually mean is that I'm bored of school.
Yeah, I know that's very rare.
But, there's a difference:
I love Mathematics and Programming!
And, because I had nothing better to do, I created this blog, in which I'm going to write everything that I care about, with the hopes that other people will find them useful.
Maybe things like:
  • Beginner's Python tutorials,
  • How to calculate the Pi number with Python,
  • How to prepare for Mathematical Competitions,
  • How to find a girl (that's pretty quick, don't do what I do...),
  • Why you should get the hell out of here and have a life,
  • Why Linux is better that Windows(in every way),
  • etc.
Well, I hope you enjoy your stay!