INTERNATIONAL INDIAN PUBLIC SCHOOL - RIYADH
Python
Practical Worksheet
Name: _________________ Grade: IX ________ Date: ___________
Program 1
#To find square of number 7
number = 7
square = number ** 2
print('Square of 7 is:',square)
Program 2
#To convert length given in km to meters
km = float(input('Enter the distance in kilometer: '))
m = km*1000
print('Distance in meter is: ',m)
Program 3
# To calculate Area and Perimeter of a rectangle
length = float(input("Enter the length of the rectangle: "))
breadth = float(input("Enter the breadth of the rectangle: "))
area=length*breadth
perimeter=2*(length+breadth)
print("Area of the rectangle is ", area)
print("Perimeter of the rectangle is:", perimeter)
1
Program 4
# To calculate area of a triangle with base and height
base = float(input("Enter the base of the triangle:"))
height = float(input("Enter the height of the triangle: "))
area = (base*height)/2
print("Area of triangle is: ", area)
Program 5
# To calculate the average marks of 3 subject
english = float(input("Enter your marks in english: "))
maths = float(input("Enter your marks in maths: "))
science = float(input("Enter your marks in science: "))
total = english+maths+science
average = total/3
print("Average mark of 3 subjects are: ", average)