Getting Started with Python - Class 11 (Informatics Practices)
1. Introduction to Python
Python is a high-level, interpreted, general-purpose programming language.
Created by Guido van Rossum in 1991.
Python is simple, readable, and beginner-friendly.
2. Features of Python
1. Easy to learn and use
2. Free and open-source
3. Platform independent
4. Interpreted (line-by-line execution)
5. Supports procedural and object-oriented programming
6. Large standard library
3. Popular Python IDEs
- IDLE (default editor)
- Jupyter Notebook (used for data science and practicals)
- PyCharm
- Google Colab (online)
4. Python Keywords
Keywords are reserved words with special meaning in Python.
Examples: if, else, while, for, def, class, import, in, not
They cannot be used as variable names.
5. Identifiers and Variables
Identifier: Name given to variables, functions, etc.
Variable: A name used to store a value.
Example:
name = "Aarushi"
age = 16
6. Data Types in Python
- int: Integer values (e.g., 5, -3, 100)
- float: Decimal values (e.g., 3.14, 0.5)
- str: String/text (e.g., "Hello")
Getting Started with Python - Class 11 (Informatics Practices)
- bool: Boolean (True, False)
7. Operators in Python
- Arithmetic: +, -, *, /, //, %, **
- Relational: ==, !=, >, <, >=, <=
- Logical: and, or, not
8. Input and Output
Input from user:
name = input("Enter your name: ")
Output:
print("Hello", name)
9. Conditional Statements
Used for decision making.
Example:
marks = int(input("Enter marks: "))
if marks >= 33:
print("Pass")
else:
print("Fail")
10. Looping in Python
while loop:
i=1
while i <= 3:
print(i)
i += 1
for loop:
for i in range(1, 4):
print(i)
11. Functions
A block of code that runs when called.
Example:
Getting Started with Python - Class 11 (Informatics Practices)
def greet():
print("Hello Aarushi!")
greet()
12. Viva/Practical Questions
- Who developed Python?
- What are identifiers?
- What is the use of the input() function?
- Name any two data types in Python.
- Write a program to check if a number is even or odd.
- What is the difference between = and == in Python?
- What will be the output of: print(5//2)?
- How do you write a comment in Python?
- What is the role of indentation in Python?
- Write a for loop to print numbers from 1 to 5.