0% found this document useful (0 votes)
5 views22 pages

Python Practical File for Class IX AI

The document is a Python practical file for Class IX at Aster Public School, Greater Noida, containing various programming exercises. It includes 20 different programs covering topics such as area and perimeter calculations, energy, simple interest, and eligibility checks. Each program is accompanied by sample code and expected output.

Uploaded by

happyjaat2012
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views22 pages

Python Practical File for Class IX AI

The document is a Python practical file for Class IX at Aster Public School, Greater Noida, containing various programming exercises. It includes 20 different programs covering topics such as area and perimeter calculations, energy, simple interest, and eligibility checks. Each program is accompanied by sample code and expected output.

Uploaded by

happyjaat2012
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASTER PUBLIC SCHOOL, GREATER NOIDA

Python Practical File

Class IX - AI 417

Session: 2025-26

Submitted by:
Name: ____________________
Class: IX
Index
[Link] Program Title Page No.
1 Area and Perimeter of Rectangle 3
2 Energy = mgh 4
3 Distance = ut + 1/2 at² 5
4 Simple Interest 6
5 Odd or Even Number 7
6 Positive, Negative or Zero 8
7 Eligible for Voting 9
8 Swap Two Variables 10
9 Celsius to Fahrenheit 11
10 Area of a Triangle 12
11 Area of a Circle 13
12 Largest of Three Numbers 14
13 Half of Age with Wow! 15
14 Vowel or Consonant 16
15 Divisible by 3 and Multiple of 5 17
16 Final Grade Pass/Fail 18
17 Salary Last Digit 19
18 Birth Year / 10 → Last Digit 20
19 Day Number to Day Name 21
20 Pension Scheme Eligibility 22
Q1. Area and Perimeter of Rectangle
Program Code:
length = 10 breadth = 5 area = length * breadth perimeter = 2 * (length +
breadth) print("Area =", area) print("Perimeter =", perimeter)

Sample Output:
Area = 50 Perimeter = 30
Q2. Energy = mgh
Program Code:
m = 10 g = 9.8 h = 5 energy = m * g * h print("Energy =", energy)

Sample Output:
Energy = 490.0
Q3. Distance = ut + 1/2 at²
Program Code:
u = 5 t = 2 a = 1 distance = u*t + 0.5*a*t*t print("Distance =", distance)

Sample Output:
Distance = 12.0
Q4. Simple Interest
Program Code:
p = 1000 r = 4 t = 5 si = (p * r * t) / 100 print("Simple Interest =", si)

Sample Output:
Simple Interest = 200.0
Q5. Odd or Even Number
Program Code:
num = 6 if num % 2 == 0: print("Number is Even") else: print("Number is
Odd")

Sample Output:
Number is Even
Q6. Positive, Negative or Zero
Program Code:
num = -3 if num > 0: print("Positive") elif num < 0: print("Negative")
else: print("Zero")

Sample Output:
Negative
Q7. Eligible for Voting
Program Code:
age = 18 if age >= 18: print("Eligible for Voting") else: print("Not
Eligible")

Sample Output:
Eligible for Voting
Q8. Swap Two Variables
Program Code:
a = 5 b = 10 a, b = b, a print("After Swap: a =", a, "b =", b)

Sample Output:
After Swap: a = 10 b = 5
Q9. Celsius to Fahrenheit
Program Code:
c = 37 f = (c * 9/5) + 32 print("Fahrenheit =", f)

Sample Output:
Fahrenheit = 98.6
Q10. Area of a Triangle
Program Code:
a = 6 b = 8 c = 10 s = (a+b+c)/2 area = (s*(s-a)*(s-b)*(s-c)) ** 0.5
print("Area of Triangle =", area)

Sample Output:
Area of Triangle = 24.0
Q11. Area of a Circle
Program Code:
r = 5 area = 3.14 * r * r print("Area of Circle =", area)

Sample Output:
Area of Circle = 78.5
Q12. Largest of Three Numbers
Program Code:
a = 5 b = 15 c = 10 largest = max(a,b,c) print("Largest =", largest)

Sample Output:
Largest = 15
Q13. Half of Age with Wow!
Program Code:
age = 20 half = age // 2 print("Half Age =", half) if half % 2 == 0:
print("Wow!!!!")

Sample Output:
Half Age = 10 Wow!!!!
Q14. Vowel or Consonant
Program Code:
ch = 'a' if [Link]() in 'aeiou': print("It is a Vowel") else: print("It
is a Consonant")

Sample Output:
It is a Vowel
Q15. Divisible by 3 and Multiple of 5
Program Code:
num = 15 if num % 3 == 0 and num % 5 == 0: print("Divisible by 3 and
Multiple of 5") else: print("Not valid")

Sample Output:
Divisible by 3 and Multiple of 5
Q16. Final Grade Pass/Fail
Program Code:
m1, m2, m3, m4 = 60, 70, 80, 40 avg = (m1+m2+m3+m4)/4 print("Average =",
avg) if avg > 50: print("Pass") else: print("Fail")

Sample Output:
Average = 62.5 Pass
Q17. Salary Last Digit
Program Code:
salary = 12345 last_digit = salary % 10 if last_digit != 0: print("Last
Digit =", last_digit)

Sample Output:
Last Digit = 5
Q18. Birth Year / 10 → Last Digit
Program Code:
year = 2005 q = year // 10 last_digit = q % 10 print("Last digit of
quotient =", last_digit)

Sample Output:
Last digit of quotient = 0
Q19. Day Number to Day Name
Program Code:
day = 3 days = {1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Frid
ay",6:"Saturday",7:"Sunday"} print("Day is", [Link](day,"Invalid"))

Sample Output:
Day is Wednesday
Q20. Pension Scheme Eligibility
Program Code:
age = 60 gender = "male" if (gender == "male" and age >= 60) or (gender ==
"female" and age >= 58): print("Eligible for Pension") else: print("Not
Eligible")

Sample Output:
Eligible for Pension

You might also like