1. To print personal information like Name, Father’s Name, Class, and School Name.
print("Name - Sanjay Parmar")
print("Father's Name - Trikambhai Parmar")
print("Class - IX")
print("School - ABC International School")
2. To find the square of the number 7
#Method 1
print(7**2)
#Method 2
print(7*7)
#Mehtod 3
import math
print([Link](7,2))
3. To find the sum of two numbers 15 and 20.
print(15+20)
4. To convert length given in kilometres into meters.
kms=5
print(kms,"kms = "5*1000, " meters")
5. To print the table of 5 up to five terms.
print(5," * ", 1, " = ", 5*1)
print(5," * ", 2, " = ", 5*2)
print(5," * ", 3, " = ", 5*3)
print(5," * ", 4, " = ", 5*4)
print(5," * ", 5, " = ", 5*5)
6. To calculate Simple Interest if the principle_amount = 2000 rate_of_interest = 4.5 time = 10.
principle_amount=2000
rate_of_nt=4.5
time=10
print("Simple Interest -", (principal*rate_of_int*time)/100)
7. To calculate Area and Perimeter of a rectangle.
l=int(input("Enter length:"))
w=int(input("Enter Width:"))
area=l*w
Perimeter= 2(l+w)
print("Area of Rectangle:",area)
print("Area of Perimeter:",Perimeter)
8. To calculate Area of a triangle with Base and Height
Base=float(input("Enter base:"))
Height=float(input("Enter height:"))
area_of_triangle=Base*Height/2
print("Area of triangle:",area_of_triangle)
9. To calculating average marks of 3 subjects.
mm=int(input("Enter Maximum marks of each subject:"))
eng=float(input("Enter marks of English:"))
maths=float(input("Enter marks maths:"))
ai=float(input("Enter AI:"))
print("Maximum marks of each subject:",mm)
avg=(eng+maths+ai)/3
print("Average of 3 subjects marks:",avg)
10. To calculate discounted amount with discount %.
bill_amt=float(input("Enter Bill Amount:"))
dis_per=float(input("Enter discount in (%):"))
dis=bill_amt*(dis_per/100)
net_amt=bill_amt-dis
print("Discount Amount:",dis)
print("Net Amount:",net_amt)
11. To calculate Surface Area and Volume of a Cuboid.
length=float(input("Enter Length:"))
breadth=float(input("Enter Breadth:"))
height=float(input("Enter Height:"))
area_cuboid = 2 * ((length * breadth) + (breadth * height) + (height * length))
volume = length * breadth * height
print("Surface area of the cuboid having length ", length, " breadth ", breadth, " and height ", height, " is --
> ", area_cuboid)
print("Volume of cuboid having length", length, " breath", breadth, " and height ", height, " is --> ",
volume)
12. Create a list in Python of children selected for science quiz with the following names- Arjun,
Sonakshi, Vikram, Sandhya, Sonal, Isha, Kartik
Perform the following tasks on the list in sequence-
Print the whole list
Delete the name “Vikram” from the list
Add the name “Jay” at the end
Remove the item which is at the second position.
stu_lst=['Arjun','Sonakshi','Vikram','Sandhya','Sonal','Isha','Kartik']
#Print the whole list
print(stu_lst)
#Delete the name Vikram
#method - 1
del stu_lst['Vikram']
#Method - 2
stu_lst.pop(stu_lst.index('Vikram'))
#Add the name "Jay" at the end
stu_lst.append('Jay')
#remove the item at second position
stu_lst.remove(stu_lst[2])
print(stu_lst)
13. Create a list of the first 10 even numbers, add 1 to each list item, and print the final list.
l=list(range(2,21,2))
print(l)
for i in range(len(l)):
l[i]=l[i]+1
print(l)
14. Create a list List_1=[10,20,30,40]. Add the elements [14,15,12] using the extend function. Now
sort the final list in ascending order and print it.
list_1=[10,20,30,40]
list_1.extend([14,15,12])
list_1.sort()
print(list_1)
15. Program to check if a person can vote.
age=int(input("Enter Age:"))
if age>=18:
print("Person is eligible for vote")
else:
print("Person is not eligible for vote")
16. To check the grade of a student
per=float(input("Enter Percentage:"))
if per>=91 and per<=100:
print("Grade:A")
elif per>=71 and per<=90:
print("Grade:B")
elif per>=51 and per<=70:
print("Grade:C")
elif per>=35 and per<=50:
print("Grade:D")
else:
print("Imrovemenet required...")
17. Input a number and check if the number is positive, negative, or zero, and display an
appropriate message.
n=int(input("Enter any number to check:"))
if n>0:
print("No is positive")
elif n<0:
print("No is negative")
else:
print("Zero")
18. Write a program to find the maximum number out of the given three numbers.
n1=int(input("Enter the Number1:"))
n2=int(input("Enter the Number2:"))
n3=int(input("Enter the Number3:"))
if n1>n2 and n1>n3:
print(n1, " - Number 1 is greater")
elif n1>n2 and n1>n3:
print(n2, " - Number 2 is greater")
elif n3>n1 and n3>n2:
print(n3, " - Number 3 is greater")
else:
print("All are same")
19. Write a program to generate the following pattern:
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
n=int(input("Enter n:"))
#Generating Pattern
k=1
for i in range(1,n+1):
for j in range(1,i+1):
print(k,end=" ")
k=k+1
print()
20. On the basis of this online tool (Visit [Link] try and write
answers of all the below-mentioned questions.
• What is the output colour when you put R=G=B=255?
• What is the output colour when you put R=G=255,B=0?
• What is the output colour when you put R=255,G=0,B=255?
• What is the output colour when you put R=0,G=255,B=255?
• What is the output colour when you put R=G=B=0?
• What is the output colour when you Put R=0,G=0,B=255?
• What is the output colour when you Put R=255,G=0,B=0?
• What is the output colour when you put R=0,G=255,B=0?
• What is the value of your colour?
21. Create your own pixels on piskelapp and make a gif image.
22. Do the following tasks in OpenCV.
• Load an image & Give the title of the image
• Change the image to grayscale
• Print the shape of image
• Display the maximum and minimum pixels of image
• Crop the image.
• Save the Image