Python can be categorized as a high level programming language. If a programming language can easily be understood by a human, we call it “high level programming language”. Python language is constructed by English words. So we can understand those words easily. The language was created by Guido Van Rossum in early nineties.
Characteristics of Python Language
- Simple – Suitable for programming beginners
- Free & Open Source
- Object Oriented Language
- Interpreted Language
- High Level Language
For any kind of programming language, there is a list of key words. For each and every key word has a special meaning. Here is the keyword list of python.
Identifier is some kind of name which is used to identify an element in a program. When we create an identifier in any kind of programming language, we have to follow some rules related with that particular programming language. When we talk about Python, we can state the rules as follows.
- All the identifiers should start with a Letter or Underscore character.
- After the first character, we can use letters, numbers or underscores ( a-z , A-Z , 0-9 , _ ).
- We cannot use keywords of Python as identifiers.
- There are no specific length for identifiers
- Python is a case sensitive language. Therefore, identifiers in a Python program also have to agree with that rule. That means, identifier name example and EXAMPLE are considered as two different identifiers.
A simple explanation of the Structure of Python Program
A python program is a collection of statements which follows rules of Python language. We use indentations (Tabs/Spaces) to mark blocks in a python program. Look at following example.
mark = 75 if mark > 50: print (“Pass”) print (“Congratulation...!”) else: print (“Fail”) print (“Try Again...!”)
You can see the print (“Pass”) & print (“Congratulation…!”) parts under the if condition have been intended and both of those parts in the same indentation level. That means print (“Pass”) & print (“Congratulation…!”) parts belong if condition. You can see the same pattern has been used in the else part of the program.
Comments in a Python Program
Using comments is a good practice in programming. Usually we use comments in a program to describe the program itself. Commenting will make our life easier when we edit/refer the program in the future. In Python, we use # (hash symbol) to indicate a comment. See the following example.
# program - find the sum of two numbers answer = 10 + 20 #(add 10 and 20 together) print(answer) # print the answer
Red lines in the above program are comments. You can see all of those red lines are starts with # mark.
Ok…! The first part of the Python Tutorial is over. Let’s meet soon with another part. If you have any problem about this lesson don’t hesitate to ask them in the comments section below and don’t forget to share this lesson with your buddies.