By Geethika Reddy ยท
Python Programs Class 12 CBSE 2026 | Informatics Practices, Computerized Accounting, Commerce
Learn important Python programs for Class 12 CBSE Informatics Practices, Entrepreneurship, and Computerized Accounting. Get easy examples, output-based questions, and exam tips to score high marks.

Python Programs for Class 12 CBSE (Commerce Stream)
Introduction
Python is an important programming language in Class 12 Informatics Practices and Computerized Accounting. CBSE often asks Python coding questions in theory and practical exams, so students must practice basic programs to score good marks.
This article covers important Python programs, explanations, tables, and exam tips for Class 12 Commerce students.
Why Python is Important for Class 12 Students
-
Easy to learn and write
-
Used in business, banking, data analysis, and software
-
High-weightage topic in CBSE syllabus
-
Helps in BCA, B.Com, BBA, and MBA future courses
Basic Python Concepts for Class 12
| Topic | Use |
|---|---|
| Variables | Store data |
| Input/Output | Take and show data |
| Operators | Perform calculations |
| If-Else | Decision making |
| Loops | Repeat tasks |
| Functions | Reusable code |
Important Python Programs for Class 12 CBSE
1. Program to Print “Hello World”
print(\"Hello World\")
Purpose: Basic output program.
2. Program to Add Two Numbers
a = int(input(\"Enter first number: \"))
b = int(input(\"Enter second number: \"))
sum = a + b
print(\"Sum is:\", sum)
3. Program to Check Even or Odd Number
num = int(input(\"Enter a number: \"))
if num % 2 == 0:
print(\"Even Number\")
else:
print(\"Odd Number\")
4. Program to Find Largest of Two Numbers
a = int(input(\"Enter first number: \"))
b = int(input(\"Enter second number: \"))
if a > b:
print(\"A is largest\")
else:
print(\"B is largest\")
5. Program to Find Largest of Three Numbers
a = int(input(\"Enter a: \"))
b = int(input(\"Enter b: \"))
c = int(input(\"Enter c: \"))
if a > b and a > c:
print(\"A is largest\")
elif b > c:
print(\"B is largest\")
else:
print(\"C is largest\")
6. Program to Print Numbers from 1 to 10 (Using Loop)
for i in range(1, 11):
print(i)
7. Program to Find Factorial of a Number
num = int(input(\"Enter a number: \"))
fact = 1
for i in range(1, num + 1):
fact = fact * i
print(\"Factorial is:\", fact)
8. Program to Check Prime Number
num = int(input(\"Enter a number: \"))
count = 0
for i in range(1, num + 1):
if num % i == 0:
count = count + 1
if count == 2:
print(\"Prime Number\")
else:
print(\"Not Prime\")
9. Program to Display Table of a Number
num = int(input(\"Enter a number: \"))
for i in range(1, 11):
print(num, \"x\", i, \"=\", num*i)
10. Program to Find Sum of Natural Numbers
n = int(input(\"Enter limit: \"))
sum = 0
for i in range(1, n+1):
sum = sum + i
print(\"Sum is:\", sum)
High-Weightage Python Programs for CBSE Exam
These programs are most important for Class 12 CBSE:
-
Add two numbers
-
Even/Odd program
-
Largest number program
-
Factorial program
-
Prime number program
-
Loop programs (1 to 10, tables)
-
Input and output programs
Python Viva Questions for Class 12
| Question | Simple Answer |
|---|---|
| What is Python? | A high-level programming language |
| What is a variable? | Used to store data |
| What is loop? | Repeats code |
| What is if-else? | Used for decision making |
| What is input() function? | Takes user input |
Tips to Score High Marks in Python (Class 12)
-
Practice writing programs daily
-
Learn syntax properly
-
Remember indentation rules
-
Practice output-based questions
-
Write clean and structured code in exam
-
Revise important programs before exam
Conclusion
Python is one of the easiest and most scoring topics in Class 12 Informatics Practices and Computerized Accounting. By practicing basic Python programs regularly, students can easily score full marks in CBSE exams. Understanding logic, syntax, and loops will help students in future courses like BCA, B.Com, BBA, Data Science, and MBA.
Click here to read about SQL Questions Class 12 CBSE 2026 | Informatics Practices, Computerized Accounting, Commerce: https://dekhocampus.com/news/sql-questions-class-12-cbse-2026