Python Language

 

What is a Language?

 

A Language is a Tool for communication. Generally, we Humans use it to communicate with another person. There are thousands of Languages in the World. In India itself there are Hundreds of Languages and it is highly impossible for a single person to know all the Language. Unless it is necessary we don't learn a Language. We, Indians utmost learn 4 to 5 Languages.

 

Do you remember how you learnt a Language? Yes at first we learned the Alphabets of the Language, then using the Alphabets we formed words. But can we mix up a set of Alphabets and say it as a word, No, words are those combination of Alphabets which will have some meaning. The Next step in the Language learning process was Forming Sentences using the Words we have learnt. Again, we cannot put up words to our liking in a Sentence. Yes, The sentences are governed by Grammar. The Grammar forms the Rule of the Language. For any Formal Communication Grammar is a must and should be strictly followed.

 

The same process we are going to follow here. Learning a Programming Language has the same steps to be followed. While Human Language is used for communication between 2 or more Humans. Programming Language is used for communication between a Human and Machine.

 

What is a Program?

 

It is nothing but a set of Instructions given to the Machine to perform a particular work. In other words, we are teaching the Machine how to do a work. Every minute details are to be taught step by step, because the Machine can't think on its own if any step goes missing. So a wrong instruction will certainly end up in wrong performance only.

 

For us to be a good programmer, the basic requirement is we should be proficient enough to teach that means we should know how to perform or how the work happens, this is called Domain Knowledge. One another requirement is proficiency in a Computer Language to convert the work steps into a Program.

 

By learning a Computer Programming Language, we learn the basics and usage methods of Language that can be utilised in the implementation of a program. A computer program is a set of instructions to the Computer in Human Languages only . But will a Computer understand that? No a machine can understand Machine Language only, otherwise called as Binary Language, a Language of 2 Letters 0s and 1s.

 

This is common even among Humans. Say for example I know only French and you don't know it, how can we communicate between us. Yes, we need a Translator who knows both French and your Language for us to make effective formal communication. Similarly a Program written in Human Language which is called SOURCE code is to be converted into EXECUTABLE Code for the Machine to understand this is taken care by COMPILERs or INTERPRETERs, which is again a Software only.

 

Therefore the Source code should be in such a format that the Compiler or Interpreter will understand them and convert them into Executable code. Some Language uses Compilers while some use Interpreters. Python uses Interpreters. That means the Source code is converted into Byte code by an Interpreter and then is executed.

 

Coming to the Language part, we will be following the same steps as we did in learning a new Human Language. The Alphabets are called Character Set of a Programming Language. Words can be classified into 3 in Languages as Keywords, Data and Operators. While Sentences are called Statements in Computer Language, The Grammar is called Syntax. Let's learn one by one.

 

Character Set

 

The Alphabets for a Programming Language is nothing but the character set used by it. There are 2 types of Character Set available.

 

-ASCII- American Standard Code for Information and Interchange

 

-EBCDIC- Extended Binary Coded Decimal Interchange Code

 

A Character in a Keyboard is not saved in its true form, Every Character is assigned a Numeric value and it converted to its Binary form and is saved. Universally, it is 1 BYTE Memory (8 BITS) that is used to save a Keyboard Character. 1 Byte information when converted to our Decimal Numbering System can be of 256 combinations or values. While in ASCII it is -128 to +127, whereas in EBCDIC it is 0 to 255. For other than Indian Languages most of the Country's Human Language Alphabets, Numerals and Special characters can be fitted in this 256 values. Whereas in Indian Languages we don't have a compiler or Interpreter developed due to this 256 values problem. In Tamil Language we have 247 Letters and if we add 10 Numerals itself we cross the 256 value. If we take other Indian Languages the Letters count is even more. Even though we Indians are Leaders in Software Industry we don't have any Compiler or Interpreter in any Indian Languages, therefore we develop Software only in English. Whereas if you want to be a Programmer in other Non-English speaking Country you need to be proficient in that Country's Local Language also, because Programs are written in their Local Language only.

 

While ASCII is Case Sensitive Language , EBCDIC is not. Some Languages follow ASCII set and some EBCDIC set. Python follows ASCII Character set and hence is Case Sensitive Language. There is a difference between Upper Case Alphabets and Lower case once.

 

Words

 

Words can be classified into 3 types in any Language one is called Keyword which is nothing but System Defined, that means the Compiler or the Interpreter has a Pre-defined meaning for the word. The next one is Data which again can be classified into 2 as Constants and Variables. Data Constants are those whose values never changes while Variables are those Data which acts as a Place holder for the actual Data, in other words it is Named Data. Other than these 2 types we have Operators which are Symbols that are used on the DATA.

 

Statements

 

The next part is learning Sentences which are called STATEMENTS. Based on the availability of Statements we can classify the Computer Languages into 3 types.

 

Low Level Language- Assembly or Micro Processor Language (All Commands will be in Mnemonics (Single word commands )) only. Mainly used to program a machine directly (System  Programing)

 

Middle Level Language- In this type few Statements go missing and also can be used for both Low Level and High Level Programming. Typical example is C Language.

 

 

High Level Language- A Language where all the Constructs are available and are used for Developing Applications. Python is considered as High Level Language only.

 

Types of Statements

 

There are  7 types of Statements available in any Computer Language. Let us see one by one and its uses. Syntax and Usages will be discussed later.

 

1. comment Statement- This statement is Non executable statement. That means the Compiler or Interpreter will ignore when it comes across this Statement.

 

2. Declaration Statement- The purpose of this statement is to declare the variables, Functions and Objects that are being used in the Program. For Compiler based Languages, this Statement helps the compiler in allocating Memory to them.

 

3. Input Statement- The purpose of this Statement is to Receive Input Data from the User, it may be through Keyboard or Files or even Mouse.

 

4. Output Statement- The purpose of this Statement is to Display the Output Data or Processed Data to the User. It can be useful to Write Data to Files too.

 

5. Assignment Statement- The purpose of this statement is to Assign values to Variables. It has 2 parts , the LHS part and RHS part. The RHS part can be Values direct or Expressions which will be evaluated and assigned. It can be even a Function call.

 

6. Control Statements- Conditional Statement

 

A Conditional is checked based on the Result the flow of Control is changed.

 

7. Control Statements- Loop Statement

 

A set of Statements is repeated for the required number of times, thus the flow of Control is changed.

No comments:

Post a Comment