07/08/2025, 20:02 Python Basic Programs for Class 9 2025-26 .
ipynb - Colab
General Instructions:
1. Students will write question and the programs neatly on A4 sheet
2. Paste the screenshot of the output after each program.
3. Start all programs from new page.
4. Include a cover page with Title -"Basic Programs in Python" and your details-Name, Admission Number, Roll No. & Class & Sec.
The link of this Colab file is as follows, students can excute the programs and get the output:
[Link]
Program-1 #WAP to find the area and perimeter of a rectangle.
L=int(input("Enter length: "))
B=int(input("Enter breadth: "))
AREA=L*B
print("Area of rectangle: ",AREA)
PERIMETER=2*(L+B)
print("Perimeter of rectangle: ",PERIMETER)
Program-2 #WAP to find the area and perimeter of a circle.
RAD=int(input("Enter radius: "))
add Code add Text
AREA=22/7*(RAD**2)
print("Area of rectangle: ",AREA)
PERIMETER=2*22/7*RAD
print("Perimeter of rectangle: ",PERIMETER)
Program-3 #WAP to convert temperature in celsius to centigrade and centigrade to celsius.
celsius = float(input("Enter temperature in Celsius: "))
fahrenheit = (celsius * 9/5) + 32
print("Fahrenheit:", fahrenheit)
fahrenheit = float(input("Enter temperature in Fahrenheit: "))
celsius = (fahrenheit-32)*5/9
print("Celsius:", celsius)
Program-4 #WAP to show all arithmetic operation.
n1 = int(input("Enter first number: "))
n2 = int(input("Enter second number: "))
print("Sum:", n1 + n2)
print("Subtraction:", n1 - n2)
print("Multiplication:", n1 * n2)
print("Division:", n1 / n2)
print("Floor Division:", n1 // n2)
print("Exponent:", n1 ** n2)
print("Remainder:", n1 % n2)
Program-5 #WAP to calculate Simple Interest and Amount.
P = int(input("Enter principle amount: "))
R = int(input("Enter rate of interest: "))
T = int(input("Enter time period:"))
SI= (P*R*T)/100
print("Simple Interest:", SI)
A=P+SI
print("Amount:", A)
Program-6 #WAP to calculate the sum of first n numbers without loop.
n1 = int(input("Enter upto which number do you want to find sum: "))
sum=(n1*(n1+1))/2
print("Sum of first", n1, "numbers:", sum)
Program-7 #WAP to convert length in centimeter to kilometer.
cm = float(input("Enter length in centimeter: "))
km = cm / 100000
[Link] 1/2
07/08/2025, 20:02 Python Basic Programs for Class 9 2025-26 .ipynb - Colab
print("Length in kilometer:", km)
Program-8 # WAP to swap 2 variables.
n1 = input("Enter first value: ")
n2 = input("Enter second value: ")
temp=n1
n1=n2
n2=temp
print("After swapping: n1 =", n1, ", n2 =", n2)
Program-9 #WAP to concatenate 2 string
str1 = input("Enter first string: ")
str2 = input("Enter second string: ")
str3 = str1+str2
print("Concatenated string:", str3)
Program-10 #WAP to find the remainder without using % operator.
a = int(input("Enter dividend: "))
b = int(input("Enter divisor: "))
remainder = a - (a // b) * b
print("Remainder:", remainder)
[Link] 2/2