Comprehensive notes Getting started with Python Class 11

In this article, we will discuss getting started with python for CBSE class 11. 

Getting started with Python

Python is a popular programming language due to its liveliness and pleasant productivity. It offers programming fun while coding. It was developed by Guido Van Rossum in February 1991 and further developed by the Python software foundation. It is a general-purpose programming language. Its syntax is easy and designed to give importance to the readability of code. It saves a few lines of codes with easy syntax rules. It is a powerful programming middle-level language but not so high-level language like C, C++, Java, etc.

 

Strengths

  1. Easy to use: The syntax of python is very simple to use compared to other programming languages.
  2. Fewer Lines code: It offers few lines of code, a programmer can write multiple lines of in a single line.
  3. Use of interpreter: Python is using an interpreter, not a compiler that executes code line by line. So it is easy for a beginner.
  4. No additional library required: When python is installed, all basic libraries installed with it. So no need to install any standard library.
  5. Platform Independent: Python can run on any platform such as Windows, Linux/UNIX, Macintosh etc. Moreover, it can run on many devices like supercomputers, smartphones. It is a portable language.
  6. Free & Open Source: It’s free of cost and can be downloaded from www.python.org. It is open-source, so source code may be available for redistribution.
  7. Offers a variety of applications: Nowadays Python is used in many devices or applications such as Scripting, Web Development, Gaming, AI, Database Development etc.

Limitations – Getting started with Python

  1. Slow execution: Python uses an interpreter that executes code line by line which is slower in execution compared to a compiler-based programming language.
  2. Less no. of libraries: Python offers limited libraries compared to other programming languages like C, C++, etc.
  3. Not strong for mobile development: It is good for desktop or server-based applications but not efficient for mobile apps.
  4. Memory Consumption: Python offers flexible data types so there is high memory consumption.
  5. Weak in database connectivity: It is not that much strong like JDBC or ODBC, its database access layer has some barriers.

Now we will discuss how to install python into your computer or laptop which is first step of Getting started with Python.

Python Installation

Before starting programming with python, it needs to be installed. There are few distributions of python available like CPython (set of applications such as python interpreter, Python IDLE and Pip), Anaconda Python distribution (Comes with preloaded packages and libraries with IDEs like Spider, Jupyter, PyCharm etc.)

Download python from www.python.org for windows suitable executable installer. The latest version of python is 3.8.3.
Please refer to this documentation for installation steps: Documentation

After installation, you need to understand python interpreter which is mostly used to interpret your code in Getting started with Python. 

Python interpreter

Python interpreter offers two modes for coding:

  1. in Interactive mode
  2. in Script mode

Working in Interactive Mode

Interactive mode allows one to type one statement and executes the same line when the enter key is pressed. To start working in interactive mode follow these steps:
Step1. Click on Start → All Programs → Python 3.7 →IDLE (Python 3.7 64-bit).

A python Shell window will appear as shown in the below-given screen:

After typing a line or statement press enter, the interpreter will execute the line and gives the result:

Working in Script Mode

Working in script mode is an essential part when you are Getting started with Python. 

To work in script mode follow these steps:
Step 1. Click on Start → All Programs → Python 3.7 →IDLE (Python 3.7 64-bit). A python shell will appear.
Step 2. Click File New. A new window will appear with the title “untitled”.
Step 3. Type the statement(s).

Step 4. Click on Run → Run Module or press F5 key.


Step 5. It prompts to save the module. Save the file with .py extension.

Step 6. The python shell display output like this:

After the understanding of print() function let’s move ahead with Getting started with Python tokens. 

Tokens – Getting started with python

Tokens are the least units of programs. These tokens are as following:

  1. Identifiers
  2. Keywords
  3. Literals
  4. Operators
  5. Puncutators

Identifiers

Identifiers are names used in programs to identify small units of programs such as variables, objects, classes, functions etc.
Identifiers defined by the following few rules as follows:

  1. It must start alphabets
  2. It can be a combination of numbers and letters
  3. Special characters are not allowed in identifiers name
  4. Spaces are not allowed in identifier names, underscore can be used to separate two words
  5. The meaning of Upper Case and Lower Case different should not use as identifier names
  6. Few Examples:
  7. MyData, roll_no, year1 etc.

Keywords

Keywords are python reserved words used in a program. Each and every keyword conveys special meaning to the python interpreter.
Ex.: def, False, if, elif, else, for etc.

Literals(Constants)

Literals or Constants means that an item(s) have a fixed value. There are several types of constants or literals as follows:

  1. String Literals: Ex.: ‘a’, ‘abc’, ‘my_name’, ‘t’, ‘n’ etc.
  2. Numeric Literals: int, float, complex etc.
  3. Boolean Literals: True or False
  4. Special Literals: None

Operators – getting started with python

Operators are symbols or words used to perform the simple calculation or logical comparison in statement or expression. Python supports these operators:

  1. Unary Operators: It requires one operand Ex.: + (Positive), – (Negative), ~ (Bit wise complement), not (Logical Negation)
  2. Binary Operators: It requires more than one operators. They are as follows:
  3. Arithmetic Operators: + (Addition), – (Subtraction), * (Multiplication), / (Division), % (Modulus/Remainder), ** (Power), // (Floor division)
  4. Bitwise operator: & (AND), ^ (XOR), I (OR)
  5. Shift Operator: << (Shift left), >> (Shift Right)
  6. Identity Operators: is, is not (compare similar identity )
  7. Relational Operators: < (less than), > (greater than), <= (less than or equal to), >= (greater than or equal to), == (equal to), != (not equal to)
  8. Logical Operators: and (Logical AND), or (Logical OR)
  9. Assignment Operators: =, /=, +=, -=, *=, /=, %=, **=, //=
  10. Membership Operators: in, not in (use to check the variable is in sequence or not)

These tokens are very important for each program of python. So when you are getting started with Python you must understand each and every aspect of them.

That’s all from getting started with python share your valuable feedback about this chapter and read other topics for class 11 from below given links.

Index Class 11

5 thoughts on “Comprehensive notes Getting started with Python Class 11”

  1. Nice work.detailed content i must send the link to my friends and thank you for give indormation to us,😍

  2. Nice work.detailed content i must send the link to my friends and thank you for give indormation to us,😍

Comment Your Views

%d bloggers like this: