Python Practice Assignment
Class-IX
Write Python Codes to:
1. print personal information like Name, Father’s Name, Class,
School Name.
2. print the following pattern using single print command.
*
***
*****
*******
*********
***********
*********
*******
*****
***
*
3. find square of number 7
4. find the sum of two numbers 15 and 20.
5. convert length given in kilometers into meters. (5km)
1. Print Personal Information
print("My name is: <Your Name>")
print("My Father's Name is: <Your father’s name>")
print("I am in 9th Grade")
print("My School Name is DAV Public School, Sreshtha Vihar, Delhi")
2. Print Pattern Using Single Print Command
print("""
*
***
*****
*******
*********
*******
*****
***
* """)
3. Find Square of Number 7
number = 7
square = number * number
print("The Square of 7 is:", square)
4. Find the Sum of Two Numbers (15 and 20)
num1 = 15
num2 = 20
sum = num1 + num2
print("Sum of 15 and 20 is:", sum)
5. Convert Kilometers to Meters
km = 5
m = km * 1000
print(km, "kilometers is", m, "meters")