History:
  Python was introduced in 1991 by Guido Van Rossum. Python is 30  years old. 1996 1.x, 2000 2.x, 2010 3.x 


Why is it booming right now?
    - Because of  its characteristics

  1. Dynamic Typing

  2. Interpreted (that runs your program in a  terminal window)

  3. Python is object oriented programming language

  4. Python code is portable(Platform Independent)

  5. It is easy and simple

  6. It is case sensitive

 

The main concepts of an object oriented programming language are:

  • Polymorphism: Using the same name for multiple functions.

  • Encapsulation: Binding data and functions as one unit.

  • Inheritance: Using functions of a preceding class.

  • Abstraction: Hiding data and sharing functions.

  • Classes: Groups of different data types and the functions to access and manipulate them. It is a user defined prototype of an object.

  • Objects: Instances of the class, things you can Operate o``

Setting up environment

Python is a cross-platform programming language, which means it runs on all the major operating systems. Most modern computers that have Python installed already.


Checking Your Version of Python 

  1. Linux -  Open terminal and type python3

  2. OSx - 


Installation

  1. Linux -
      $ sudo add-apt-repository ppa:fkrull/deadsnakes

  $ sudo apt-get update
  $ sudo apt-get install python3.8
      These commands will install Python 3.8 to your system. The following code will start a terminal session running Python 3.8:



  1. Window
    Click on link and follow steps  Click me

  2. OSx -  python is already installed. If not Click here and download and install


Write First “HelloWorld” Python Program

  1. Open text editor and create a new file and write below code and save with .py extension.
    print(“Hello World”)

  2. Open terminal and go to file save directory and type below command

python fileName.py



Identifiers

  • It is used to identify a variable, function, class, module or other object.

  • Identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9). 


Keyword:

  • Keywords are reserved words and you cannot use them as identifier names.

  • There are a total 33 keywords in Python 3.8.2. 


Get Keyword list using python program

            >>> import keyword

            >>> keyword.kwlist #it will print all keyword

           >>> a = keyword.kwlist

          >>> a.len() 


Comment:

  • Comment is not a part of our programming language.

  • comment statements are skipped while executing your program.


There are two types of comments.

  1. Single Line Comment (#)

  2. Multiple Line Comment (''' ''')


msg = "hello comments" # a msg containing something


print(msg) #print statement to print contents of a msg

Categories: Python Tags: #Python,

Comments