Class 12 CS (Python) Notes - Unit 1: Python Revision Tour

Class 12 Computer Science (083) - Unit 1: Python Revision Tour

By Devanshu Sir | Board Exam Special Notes

Hello Class 12 Warriors! बोर्ड एग्जाम की तैयारी यहीं से शुरू होती है। 11th में जो Python पढ़ा था, उसे जल्दी से Revise करते हैं क्योंकि आगे के चैप्टर्स (Functions, File Handling) इसी पर टिके हैं।

1. Tokens in Python

Python प्रोग्राम की सबसे छोटी इकाई (Unit) को Token कहते हैं। ये 5 प्रकार के होते हैं:

  • Keywords: Reserved words (e.g., if, else, def, while).
  • Identifiers: Names given to variables (e.g., student_name, marks).
  • Literals: Fixed values (e.g., 25, "Hello", 3.14).
  • Operators: Symbols for calculation (e.g., +, -, *, /, %).
  • Punctuators: Symbols like (), {}, [], : used in code.

2. Control Statements (if-else & Loops)

प्रोग्राम का फ्लो कण्ट्रोल करने के लिए हम Loops और Condition का यूज़ करते हैं।

Indentation: Python में { } ब्रैकेट नहीं होते, स्पेस (Indentation) का यूज़ होता है। अगर स्पेस गलत हुआ तो IndentationError आएगा।

Example Code: Checking Even/Odd

# Program to check Even or Odd
num = int(input("Enter a number: "))

if num % 2 == 0:
    print("Number is Even")
else:
    print("Number is Odd")

3. Loops (for & while)

जब एक ही काम बार-बार करना हो, तो Loop का यूज़ होता है।

  • range() function: range(start, stop, step). याद रहे, stop value कभी print नहीं होती।
  • Ex: range(1, 5) -> 1, 2, 3, 4 (5 नहीं आएगा)

🔥 Board Exam Question: Find Output

Q. What will be the output of following code?

for i in range(1, 4):
    print(i * 10, end=" ")

Answer:

10 20 30
🎯 Watch Revision Tour Full Video

© 2026 DevaHelper - Coding with Devanshu. All Rights Reserved.

Comments