Python Practical Set-1

🐍 O Level Python Programming PR3 Practical With Solution

Are you preparing for the O Level Python Programming PR3 Practical Exam?
This post provides simple, exam-focused Python programs with solutions, based on the latest NIELIT syllabus for July 2025.


✅ Q1. Calculate Area of Triangle by User Input (Base & Height)

🧪 Python Program:

base = float(input("Enter base: "))
height = float(input("Enter height: "))
area = 0.5 * base * height
print("Area of triangle:", area)

📝 This program takes base and height from the user and calculates the area using the formula: ½ × base × height.


✅ Q2. Python Program to Find Number of Days Between Two Given Dates

🧪 Python Program:

from datetime import date
date1 = date(2025, 7, 20)
date2 = date(2025, 8, 5)
diff = date2 - date1
print("Number of days:", diff.days)
[py] from datetime import date
date1 = date(2025, 7, 20)
date2 = date(2025, 8, 5)
diff = date2 – date1
print(“Number of days:”, diff.days)
[\py]

📝 It uses the datetime module to calculate the difference in days between two specific dates.


✅ Q3. Check Whether a Passed Letter is a Vowel or Not

🧪 Python Program:

letter = input("Enter a letter: ").lower()
if letter in ['a', 'e', 'i', 'o', 'u']:
    print("It is a vowel.")
else:
    print("It is not a vowel.")

📝 This simple code checks whether the given character is a vowel using a list and conditional check.


🎯 Practice More with Mock Tests

👉 Take full Real Exam Interface Mock Tests here:
🔗 https://gyanxp.com/o-level-practical-mock-test/