Class 11 Computer Science – Chapter 5 (Sumita Arora)
Getting Started with Python
1. Introduction
Python is a high-level, general-purpose, interpreted language developed by Guido van Rossum in
1991.
2. Features of Python
- Simple and readable
- Free and open-source
- Portable
- Extensible
- Rich standard library
- Supports multiple paradigms
3. Execution Modes
Interactive Mode: Executes commands line by line.
Script Mode: Code is saved in .py files and executed.
4. Program Structure
Includes statements, expressions, comments, and indentation.
5. Comments
Single-line: # comment
Multi-line: """ comment """
6. Variables
Variables store values and are created through assignment.
Rules:
- Start with letter or underscore
- Case-sensitive
- No special characters except underscore
7. Data Types
Numeric (int, float, complex)
Boolean (True, False)
String ("text")
NoneType (None)
8. Operators
Arithmetic: + - * / % // **
Relational: == != > < >= <=
Logical: and or not
Assignment: = += -=
Membership: in, not in
Identity: is, is not
9. Expressions
Combination of operators and operands.
10. Input and Output
input(): takes user input as string
print(): displays output
Supports sep and end parameters.
11. Indentation
Mandatory for defining code blocks.
12. Errors
Syntax Errors
Runtime Errors
Logical Errors
13. Keywords
Reserved words like if, else, while, for, break, continue, True, False, None, etc.
Summary
Python is simple, interpreted, and powerful. It uses indentation, supports many data types, and
provides strong input/output functionalities.