🎓 Senior Secondary
| CBSE • Computer Science

Introduction to Python

Installation, IDLE, data types, operators, expressions.

1 Lesson 1 MCQ 1 Mnemonic
+30
XP
Available to earn
1
Lesson

Introduction to Python — Lesson

1) Hook — A Fun Real-Life Example

Imagine you want to create a simple program that helps you calculate your monthly mobile recharge expenses automatically. Instead of doing it manually every month, you write a small program that takes your recharge amount and number of months as input and gives you the total expense. This is where Python comes in — a powerful yet easy-to-learn programming language that can make such daily tasks simple and fast!

2) Core Concepts — Introduction to Python

Python is a high-level, interpreted programming language known for its simplicity and readability. It is widely used in India and globally for web development, data science, automation, and more.

Feature Description Example
Interpreted Language Python code runs line-by-line without prior compilation. print("Hello, India!")
Dynamic Typing Variable types are determined at runtime. x = 10
x = "Delhi"
Indentation Blocks of code are defined by indentation, not braces. if x > 5:
    print("x is greater than 5")

Basic Python Program Example:

# Program to add two numbers
num1 = 15
num2 = 25
sum = num1 + num2
print("Sum =", sum)
  

3) Key Formulas / Rules

Rule 1: Variable Assignment

Variables do not require explicit declaration. Assign values directly.

variable_name = value

Rule 2: Indentation

Use consistent indentation (usually 4 spaces) to define code blocks.

Rule 3: Print Statement

Use print() to display output.

Example: print("Namaste, Python!")

Rule 4: Comments

Use # for single-line comments.

Example: # This is a comment

4) Did You Know?

Python was created by Guido van Rossum and first released in 1991. Interestingly, the name “Python” was inspired not by the snake, but by the British comedy series “Monty Python’s Flying Circus” — reflecting the language’s creator’s love for humor and simplicity!

5) Exam Tips

  • Indentation Errors: Python is sensitive to indentation. Always use consistent spaces (preferably 4) and avoid mixing tabs and spaces.
  • Variable Naming: Use meaningful variable names and avoid starting with numbers or special characters.
  • Print Syntax: Remember to use parentheses with print() in Python 3 (e.g., print("Hello")).
  • Previous Year Question Pattern: Questions often ask to write simple Python programs for basic arithmetic, input/output operations, or to identify errors in given code snippets.
  • Practice Writing Code: Board exams may include writing short programs or tracing output. Practice writing and dry-running code on paper.
2
MCQ Practice

Introduction to Python — Mcq

3
Memory Trick

Introduction to Python — Mnemonic

Mnemonic 1: PYTHON 🐍 - "Easy as ABC for Indian Coders!"

  • P - Print your ideas on screen 🖨️
  • Y - Yahan sab simple hai (Everything here is simple!) 🇮🇳
  • T - Typing is easy, no semicolons needed ✍️
  • H - Hindi bhi samjho, Python sabko samjhaata hai 📚
  • O - Objects and data types, sab organized 🧩
  • N - No stress, just code and impress! 🎉

Mnemonic 2: "Python ka funda - SABSE AASAN" 🎯

  • S - Simple syntax, bilkul seedha (Straightforward) ✔️
  • A - Automatic memory management, tension free! 🧠
  • B - Blocks by indentation, no curly braces ka jhanjhat 🚫{}
  • S - Strings and lists, sab powerful aur easy 🎈
  • E - Easy to learn, beginners ke liye best friend 🤝
  • A - Applications wide, from web to AI 🤖
  • S - Simple commands, like print() and input() 🖥️
  • A - Ab sab samajh aa gaya! (Now everything is clear!) 🎓
  • N - Next step: coding karna shuru karo! 🚀

Mnemonic 3: "Python Basics - 'I LOVE CODE' 💻❤️"

  • I - Indentation matters, no braces ka drama 🚫
  • L - Loops like for and while, repeat karo baar-baar 🔄
  • O - Objects and classes, OOP ka funda samjho 🏫
  • V - Variables, jahan data store karte ho 💾
  • E - Expressions and operators, maths ko easy banao ➕➖
  • C - Comments daalo, taaki code samajh aaye 📝
  • O - Output ke liye print() ka use karo 🖨️
  • D - Data types jaise int, float, string samjho 🔢
  • E - Error handling se daro mat, seekhne ka part hai! 🚧
Interactive

Mission: Master This Topic!

Reinforce what you learned with fun activities

🎯

Ready to Battle? Test Your Knowledge!

Practice MCQs, build combos, climb the leaderboard!

Start Practice

Loading...

Hey! 🔥 Your 7-day streak is at risk. Complete one quick quest today?

Streak broken? No worries. Recover with bonus XP by completing a quest now.