×

Python

📌 Important Notice & Guidelines

  • Scholarship Rule: The percentage of marks you score in the test will be equal to the percentage of scholarship you receive.
  • Weekly Test: Tests will be conducted every Friday.
  • Result Update: Your marks/results will be updated on the WhatsApp Channel every Saturday.
  • New Batches: New batches will start every Monday.

1. Introduction to Python

Python is a high-level, interpreted programming language that is easy to learn and widely used for web development, data science, AI, machine learning, automation, and more. Python’s syntax is simple, readable, and similar to English.

print("Welcome to Python!")
                

Welcome to Python!

2. Installing Python

Download the latest version from python.org. Choose the right installer for Windows, Mac, or Linux. Make sure to check the “Add Python to PATH” option.

print("Python Installed Successfully")
                

Python Installed Successfully

3. Python IDE / Editor

You can write Python programs using IDLE, PyCharm, VS Code, or online editors like Replit. IDEs provide code highlighting, auto-completion, and debugging tools.

# This is a comment
print("Using IDE")
                

Using IDE

4. First Program: Hello World

The first program in any language is to print “Hello World”. It ensures your environment is working.

print("Hello World")
                

Hello World

5. Variables

Variables store data in memory. Python variables do not require explicit declaration.

name = "Avinash"
age = 20
print("Name:", name)
print("Age:", age)
                

Name: Avinash
Age: 20

6. Data Types

Python supports int, float, str, bool, list, tuple, set, and dictionary.

a = 10        # int
b = 3.14      # float
c = "Python"  # str
d = True      # bool
print(a, b, c, d)
                

10 3.14 Python True

7. Comments

Comments explain code. Single-line with #, multi-line with triple quotes ’’’ ’’’.

# This is a comment
'''
This is a
multi-line comment
'''
print("Comments Example")
                

Comments Example

8. Input / User Input

Use input() to get user input. By default, input is a string.

name = input("Enter your name: ")
print("Hello", name)
                

Enter your name: Avinash
Hello Avinash

9. Operators

Arithmetic (+, -, *, /, %), comparison (==, !=, >, <), logical (and, or, not).

a = 10
b = 3
print("Addition:", a + b)
print("Modulus:", a % b)
                

Addition: 13
Modulus: 1

10. Conditional Statements

Make decisions using if-else and elif statements.

age = 18
if age >= 18:
    print("You can vote")
else:
    print("You cannot vote")
                

You can vote

11. Loops

Repeat code using for and while loops.

for i in range(5):
    print("Number:", i)
                

Number: 0
Number: 1
Number: 2
Number: 3
Number: 4

12. Lists

Store multiple ordered items. Access using index. Lists are mutable.

fruits = ["apple", "banana", "mango"]
print(fruits[1])
fruits.append("orange")
print(fruits)
                

banana
['apple', 'banana', 'mango', 'orange']

13. Dictionaries

Store data as key-value pairs. Access values using keys.

person = {"name": "Avinash", "age": 20}
print(person["name"])
person["city"] = "Delhi"
print(person)
                

Avinash
{'name': 'Avinash', 'age': 20, 'city': 'Delhi'}

14. Functions

Functions are reusable code blocks. Can take parameters and return values.

def greet(name):
    return "Hello " + name
message = greet("Avinash")
print(message)
                

Hello Avinash

15. Next Steps

Learn file handling, modules, OOP, exception handling, and libraries like NumPy, Pandas, Matplotlib for advanced Python.

import math
print(math.sqrt(16))
                

4.0

Best of Luck to All Students!

Give your best in the test, stay focused, and keep learning something new every day. Believe in yourself, and let each lesson make you stronger and smarter.

WhatsApp Chat