75% found this document useful (4 votes)
6K views

IX Practical File Python

This document contains 16 programming problems for Class 9 students to practice. The problems cover a range of concepts like input/output, arithmetic operations, conditional statements, loops, lists, and string manipulation. Some example problems include printing personal details after taking user input, calculating area and perimeter of a rectangle, checking if a number is positive or negative, reversing a user-entered word, and squaring numbers in a list.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
75% found this document useful (4 votes)
6K views

IX Practical File Python

This document contains 16 programming problems for Class 9 students to practice. The problems cover a range of concepts like input/output, arithmetic operations, conditional statements, loops, lists, and string manipulation. Some example problems include printing personal details after taking user input, calculating area and perimeter of a rectangle, checking if a number is positive or negative, reversing a user-entered word, and squaring numbers in a list.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

CLASS IX

PRACTICAL FILE PROGRAMS

1. Write a program to print personal information.


a = input (“ Enter your name:”)
b = input (“ Enter your father’s name:”)
c = input (“ Enter your class:”)
d = input (“ Enter your school name:”)
print(a)
print(b)
print(c)
print(d)

2. Print square of 2 numbers.

a = int (input(“Enter first number”))


b = int (input(“Enter second number”))
c=a+b
print(c)

3. Convert given length in km to meters.

a = int (input ( “Enter length in kilometers”))


b = a * 1000
print( “Length in meters = “,b)

4. Calculate area and perimeter of rectangle.


l = int(input (“ Enter length of rectangle”))
b = int(input(“ Enter breadth of rectangle”))
a=l*b
p = 2 * ( l+b )
print(“The area of rectangle =”,a)
print(“ The perimeter of rectangle =”,b)

5. Calculate area of right angled triangle.


b = int(input(“Enter base of triangle”))
h = int(input(“Enter height of triangle”))
a=½*b*h
print( “Area of right angled triangle =”, a )

6. Calculate average marks of 3 subjects.


a = int(input(“Enter first number”))
b = int(input(“Enter second number”))
c = int(input(“Enter third number”))
avg = (a+b+c)/3
print(“ The average of three numbers =”, avg)

7. Calculate simple interest for principal amount = 2000, rate of interest


4.5% and time 10 years.
pa = 2000
roi = 4.5
t = 10
si = (pa * roi * t)/100
print(“Simple interest =”, si)
8. Program to check if a person can vote .
age = int(input(“Enter your age”))
if age>= 18:
print(“You are eligible to vote”)
else:
print(“You are not eligible to vote”)

9. Program to check if a number is positive or negative.


nmu = float(input(“Enter a number”))
if num >= 0:
if num == 0:
print(“Zero”)
else:
print(“Positive number”)
else:
print(“Negative number”)

10. To check the grades of a student.


marks = float(input(“Enter marks”))
if marks > 75:
print (“A Grade”)
elif marks > 60 :
print(“ B Grade”)
else:
print(“C Grade”)

11. To print first 10 natural numbers.


i=1
n = 10
while i <= n:
print(i)
i=i+1

12. To print first 10 even numbers.


i=1
n = 20
while i < = n:
print(i)
i = i+2

13. To print sum of 10 natural numbers.


n = 10
sum = 0
i=1
while i <= n:
sum = sum + i
i=i+1
print(“The sum = “, sum)

14. Create a list of children selected for Science quiz with following names:
List = [ “Aryan”, “Sonakshi”, “Vikram”, “Sandhya”, “Sonal”, “Isha”, “Karan”]
print(List)
List.remove(2)
List.append(“Jay”)
List.remove(1)

15. To accept a word from the user and reverses it.


word = input(“ Input a word to reverse”)
for char in range(len(word) – 1, -1, -1):
print(word[char], end = “”)
print(“\n”)

16. To turn every item of a list into its square.


numbers = [1,2,3,4,5,6]
res = []
for i in numbers:
res.append(i*i)
print(numbers)
print(res)

You might also like