Python History and Syntax
Published: Sep 7, 2022
4min read
So let’s start!!!
History of Python
Python widely used general-purpose, high-level programming language, which is most of the known for simplicity a programming language can give.
The creator of Python , Guido Van Rossum started to work on it in CWI at Netherland. As he already contrubute to ABC programming language which has Exception Handling (error tackling) feature and has good iterface with Amoeba Operating System .
So he think why not we use ABC’s syntax and it’s amazing feature to create a unique, easy to express programming language. At first there are too many problems with this new programming language, but he solve them and give us most loved programming language.
So why name it Python?
To known why?, let’s go to 1991 when it is going to realease. At that time it’s creator Guido Van Rossum want a unique, sort and mysterious name for it’s most amazing invention. At that time he come across a popular BBC comedy series called Monty Python’s Flying Circus and he decided to use Python as name.
It’s application is seen in a lot of field, some of them are:
- Data Analysis and Processing
- Artificial Intelligence
- Games
- Hardware/Sensor/Robots
- Desktop Applications
Installing Python
For Windows and Mac:
Go to Python’s official site and download the binary (.exe). After that install on computer like any other program.
For Linux:
Most of linux distros comes with python already installed. If you don’t have installed don’t worry!, by typing following command in terminal you have this amazing programming language.
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install python3
After installing Python, you can check it by executing
python3 --version
Hello, World!
Open terminal/command prompt and type following sentences.
python3
You can see bunch of information like python version, Clang version and other stuffs. Feel free to explore things on your own!.
Now type,
>>> print("Hello, World!")
this will print Hello, World! to terminal, and that’s it!. You write your first Python program.
Python Interpreter
Above code you write is in Python’s interpreter. Interpreter are allow you to write and execute each line of code quickly without you need to run program manually each time.
This is a similar to Google Colab or Jupyter Notebook.
Syntax
Python is famous for it’s easy to ready syntax. In Hello, World! example you can see that, you don’t need any boilercode (e.g. java code) to write simple program like this.
Insted Python realy on indentation block means, some fix number of spaces/tabs are necessary for indicating each block of code.
def main():
print("Hi!") // see before print there is some spaces!
main() // calling function
above code will run without error, now for below… try to run it and see what happen
def main():
print("Oh no! it's broke.")
when running this code you get an error saying,
telling you have miss indentation or you accidentally type an extra space/tab. As a beginner you can get frustrated, but cool you mind and see error closely and get what and where things go out of wild.
Comments
Usually comments are helpfull for programmers rather than computer. This lines are ignored by Python. To take note comments tell other programmer detail of function/program or what this thing do and sometime how this do.
In Python there are two types of comments
- Single line comment (#)
- Multi line comment (''' ''')
- Single line comment
This comment start with pound (#) symbol at front of line. Python simply ignore this line.
- Multi line comment
Some time you have to explain things in multiple line, in that case you can use multi-line comment by putting ''' start and ''' end of line.
# Single line comment, this line ignored by python
print("What's up!")
'''
this also ignored!!
Multi
line
comment.
below function add 'a' and 'b'
a: number
b: number
'''
def add(a,b):
return a + b