Python Tutorial Chapter 1 - Beginning 05-09-2013, 07:35 PM
#1
Chapter -1 Introduction to Python
Absolute Beginning
:-> Intro
Welcome here!
This is my first guide on HC family.
If I make any mistakes feel free to point me
This work is 100% by me.
(0x00)Python Installation
To install python, you need to download latest version of python from
The download list contains respective installer for cross platforms.
But if your box is *nix (either Unix based or Linux based) it’ll be under /usr/bin/python
For calling python shell anytime ->
Goto Control Panel > System > Advanced > Environment Variables
Then edit PATH, copy this sentence
If it’s in *nix box it probably pre-installed
You can know if your box has python or not by typing “python –v” in your shell. If the terminal or shell shows the python version, It means that your box has python pre-installed.
Or if shell shows “python command not found” then you don’t have python yet.
I'll will explain *nix installation later.
You can see your python version in
Start Menu -> All programs (win7)
Inside python folder, you will see five files :
IDLE (Python GUI), Module doc, Python (Command line), Python Manual, Uninstall python.
There are two relatively important thing for python:
Python shell aka Python Interpreter (Python command line)
IDLE (Integrated Development Environment) (IDLE Python GUI)
(0x01)Choosing your Editor
You need to choose a good editor. A good editor has syntax highlighting, which is a great advantage in coding.
Python has a special editor -> Pyscripter, which is used by many fellow python programmers. Unfortunately it has only Windows version.
You can use other open source editors such as gedit and Notepad++.
As a piece of advice, don’t ever use the window’s built-in notepad as an editor for newbies, because it doesn’t have syntax highlighting. So here comes the question. Why would you need syntax highlighting? If there’s no syntax highlighting, your coding are more prone to “error” or so called “bugs”. IDLE and Notepad++ has syntax highlighting. And in windows, Pyscripter is highly recommended.
Python script file can be run directly or inside built-in python shell.
Python shell also known as Python interpreter is vital to python programming language, because python is an interpreted language, so interpreter is necessary.
One distinct feature of python language is that you don’t have to wait to finish the whole program to know what the codes does, you can input the codes directly into python shell to see what it does. On the other hand, in cases such as in C language and Java, you need to finish the whole program then compile and then only run, to see what the code does. So isn’t python convenient?
(0x02)Writing your first program -> The helloworld.py
Every new comers to programming language, starts with legendary “hello world” program. Ok let’s try it!
Open your editor. Type in the following codes
Then save it as helloworld.py then run it.
In *nix box you need to first give the script execute permission with chmod a+x hello.py
Then run the program. You’ll see
#!/usr… line is called shebang line. It is used to tell the system, from which interpreter we will use to run this script/program.
Print syntax will show the sentence as an output on the screen.
You can type help(syntax) to know what the syntax does. In other words, it’s sort of like man page.
(0x03)Summary
[video]
After this Chapter – 1 ->
You should know briefly about python
You should understand that algorithms is the sequence of steps to write your program.
Algorithms has expressions and statements too.
Expressions are values, for instance 9 + 1 is an expression. It’ll show you the value 10.
Variable is, technically taking space in memory. Variable can also be like x, unknown.
Remember what the “print” syntax does.
---------------------------------------------------------------------------------------------------
New Functions in this Chapter
===== =======
Function Description
===== =======
print Shows the standard output
-----------------------------------------------------------------------------------------------------------
This is the end of the chapter-1:bye:
Thanks for reading,
If you find any mistakes feel free to tell me to fix
mile:
MrGeek@HC:~>logout
To be Continued
Absolute Beginning
:-> Intro
Welcome here!
This is my first guide on HC family.
If I make any mistakes feel free to point me

This work is 100% by me.
(0x00)Python Installation
To install python, you need to download latest version of python from
Code:
www.python.org
The download list contains respective installer for cross platforms.
Quote:Windows -> .msiAfter installation, if your box is windows, the installation directory would be c:\pythonx where x represent the python version number.
*nix -> .tar.gz
Mac -> .dmg
But if your box is *nix (either Unix based or Linux based) it’ll be under /usr/bin/python
For calling python shell anytime ->
Goto Control Panel > System > Advanced > Environment Variables
Then edit PATH, copy this sentence
Code:
“;C:\Python33”
If it’s in *nix box it probably pre-installed
You can know if your box has python or not by typing “python –v” in your shell. If the terminal or shell shows the python version, It means that your box has python pre-installed.
Or if shell shows “python command not found” then you don’t have python yet.
I'll will explain *nix installation later.
You can see your python version in
Start Menu -> All programs (win7)
Inside python folder, you will see five files :
IDLE (Python GUI), Module doc, Python (Command line), Python Manual, Uninstall python.
There are two relatively important thing for python:
Python shell aka Python Interpreter (Python command line)
IDLE (Integrated Development Environment) (IDLE Python GUI)
(0x01)Choosing your Editor
You need to choose a good editor. A good editor has syntax highlighting, which is a great advantage in coding.
Python has a special editor -> Pyscripter, which is used by many fellow python programmers. Unfortunately it has only Windows version.
You can use other open source editors such as gedit and Notepad++.
As a piece of advice, don’t ever use the window’s built-in notepad as an editor for newbies, because it doesn’t have syntax highlighting. So here comes the question. Why would you need syntax highlighting? If there’s no syntax highlighting, your coding are more prone to “error” or so called “bugs”. IDLE and Notepad++ has syntax highlighting. And in windows, Pyscripter is highly recommended.
Python script file can be run directly or inside built-in python shell.
Python shell also known as Python interpreter is vital to python programming language, because python is an interpreted language, so interpreter is necessary.
One distinct feature of python language is that you don’t have to wait to finish the whole program to know what the codes does, you can input the codes directly into python shell to see what it does. On the other hand, in cases such as in C language and Java, you need to finish the whole program then compile and then only run, to see what the code does. So isn’t python convenient?
(0x02)Writing your first program -> The helloworld.py
Every new comers to programming language, starts with legendary “hello world” program. Ok let’s try it!
Open your editor. Type in the following codes
Code:
#!/usr/bin/env python
print(“Hello World!”)
Then save it as helloworld.py then run it.
In *nix box you need to first give the script execute permission with chmod a+x hello.py
Then run the program. You’ll see
Quote:QuoteAbove sentence.
Hello World!
#!/usr… line is called shebang line. It is used to tell the system, from which interpreter we will use to run this script/program.
Print syntax will show the sentence as an output on the screen.
You can type help(syntax) to know what the syntax does. In other words, it’s sort of like man page.
(0x03)Summary
[video]
Code:
https://www.youtube.com/watch?v=Gp60Qp3GUBU
After this Chapter – 1 ->
You should know briefly about python
You should understand that algorithms is the sequence of steps to write your program.
Algorithms has expressions and statements too.
Expressions are values, for instance 9 + 1 is an expression. It’ll show you the value 10.
Variable is, technically taking space in memory. Variable can also be like x, unknown.
Remember what the “print” syntax does.
---------------------------------------------------------------------------------------------------
New Functions in this Chapter
===== =======
Function Description
===== =======
print Shows the standard output
-----------------------------------------------------------------------------------------------------------
This is the end of the chapter-1:bye:
Thanks for reading,
If you find any mistakes feel free to tell me to fix

MrGeek@HC:~>logout
To be Continued