0% found this document useful (0 votes)
26 views7 pages

Xi Ip Sa1 Practical File Que With Ans

Uploaded by

Finn McMissile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views7 pages

Xi Ip Sa1 Practical File Que With Ans

Uploaded by

Finn McMissile
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Lalaji Memorial Omega International School Aca.

Yr[2022-23]

Informatics Practices
Practical File
PROGRAM 1:
A) DESCRIPTION:
Write a Menu driven python program to accepts two integers and do all
arithmetic operations (+ , - ,*,/,//,**).
SOURCE CODE:
#PROGRAM TO DO ARITHMETIC OPERATIONS
print("1.Addition +")
print("2.Subraction -")
print("3.Multiplication *")
print("4.Division /")
print("5.Floor Division //")
print("6.Exponentiation **")
choice=input("Enter Your choice [ +,-,*,/,//,**]")
Num1=int(input("Enter First Number:"))
Num2=int(input("Enter Second Number:"))
if choice=='+':
result=Num1+Num2
elif choice=='-':
result=Num1-Num2
elif choice=='*':
result=Num1*Num2
elif choice=='/':
result=Num1/Num2
elif choice=='//':
result=Num1//Num2
elif choice=="**":
result=Num1**Num2
else:
print("Invalid Choice")
print("The Result is", result)
Lalaji Memorial Omega International School Aca.Yr[2022-23]

PROGRAM 2:
A) DESCRIPTION:
Write a python program to accept a character from the user and display
whether it is a vowel or consonant.

SOURCE CODE:

#PROGRAM TO DO CHECK VOWEL OR CONSONANT


ch=input("Enter Any Character:")
if ch=='a' or ch=='A':
print(ch,"is a vowel")
elif ch=='e' or ch=='E' :
print(ch,"is a vowel")
elif ch=='i' or ch=='I' :
print(ch,"is a vowel")
elif ch=='o' or ch=='O' :
print(ch,"is a vowel")
elif ch=='u' or ch=='U' :
print(ch,"is a vowel")
else:
print(ch,"is a consonant")

B) DESCRIPTION:

Write a python program to do swapping of two numbers using third variable.

SOURCE CODE:

#PROGRAM TO DO SWAPPING OF TWO NUMBERS


Num1=int(input("Enter First Number:"))
Num2=int(input("Enter Second Number:"))
print("Before Swapping","Num1=",Num1,"Num2=",Num2)
temp=Num1
Num1=Num2
Num2=temp
print("After Swapping","Num1=",Num1,"Num2=",Num2)
Lalaji Memorial Omega International School Aca.Yr[2022-23]

PROGRAM 3:

A) DESCRIPTION:

Write a python program that inputs a student’s marks in five subjects (out of
100) and prints the total and average and display the grade based on the average of
the marks.

Average Grade
>=90 A
>=80 and <90 B
>=70 and <80 C
>=60 and <70 D
Other E

SOURCE CODE:
# Write Python code to display Total, Average and
Grade.
Eng=int(input("Enter marks of the first subject: "))
IIlang=int(input("Enter marks of the second subject: "))
Math=int(input("Enter marks of the third subject: "))
Sci=int(input("Enter marks of the fourth subject: "))
Soc=int(input("Enter marks of the fifth subject: "))
tot=Eng+IIlang+Math+Sci+Soc
avg=int(tot/5)
print("Total Marks :",tot)
print("Average:",avg)
if(avg>=90):
print("Grade: A")
elif(avg>=80&avg<90):
print("Grade: B")
elif(avg>=70&avg<80):
print("Grade: C")
elif(avg>=60&avg<70):
print("Grade: D")
else:
print("Grade: E")
Lalaji Memorial Omega International School Aca.Yr[2022-23]

PROGRAM 4:

A) DESCRIPTION:

Write a Python program to Compute area of square

SOURCE CODE:
#PROGRAM TO FIND AREA OF SQUARE

Num1=int(input("Enter SIDE:"))

area=side*side

print("Area of square is ", area)

B) DESCRIPTION:

Write a python program to compute Compound interest [A = P(1 + R/100) t


,Compound Interest = A – P ]

Where, A is amount P is the principal amount R is the rate and T is the time span
Input: Principle (amount): 1200, Time: 2, Rate: 5.4
Output: Compound Interest = 133.099243

SOURCE CODE:
#PROGRAM TO FIND Compound Interest

principal=float(input("Enter Principal Amount :"))

rate=float(input("Enter Rate :"))

time=int(input("Enter time:"))

Amt=principal*((1+rate/100)**time)

CI=Amt-principal

print("Compound Interest is ", CI)


Lalaji Memorial Omega International School Aca.Yr[2022-23]

PROGRAM 5:

A) DESCRIPTION:

Write python program to compute Simple Interest [SI =p*r*t/100 ]

SOURCE CODE:
#PROGRAM TO FIND Simple Interest

principal=float(input("Enter Principal Amount :"))

rate=float(input("Enter Rate :"))

time=int(input("Enter time:"))

SI=principal*rate*time/100

print("Simple Interest is ", SI)

B) DESCRIPTION:

Write a python program to check for eligibility to vote

SOURCE CODE:
#PROGRAM TO CHECK ELIGIBILITY TO VOTE

Age=int(input("Enter Your Age :"))

if Age>=18:

print("You are Eligible to vote" )

else:

print("Not Eligible to Vote")


Lalaji Memorial Omega International School Aca.Yr[2022-23]

PROGRAM 6:

A) DESCRIPTION:

Write a python program to find whether a given number is even or odd.

SOURCE CODE:
#PROGRAM TO CHECK ODD OR EVEN

Num=int(input("Enter Any Number :"))

if Num%2==0:

print("The number",Num,"is even Number" )

else:

print("The number",Num,"is odd Number)

B) DESCRIPTION:

Write a python program to find largest number among three integers using
nested if statement.

SOURCE CODE:
#PROGRAM TO FIND LARGEST OF THREE NUMBERS
Num1=int(input("Enter Number1 :"))
Num2=int(input("Enter Number2 :"))
Num3=int(input("Enter Number3 :"))
if (Num1>Num2):
if(Num1>Num3):
print(Num1,"is the largest number")
else:
print(Num3,"is the largest number")
else:
if(Num2>Num3):
print(Num2,"is the largest number")
else:
print(Num3,"is the largest number")
Lalaji Memorial Omega International School Aca.Yr[2022-23]

PROGRAM 7:
A) DESCRIPTION:
Write a python program to check entered number is positive or negative.

SOURCE CODE:
# Program to find positive or negative number
num=int(input("Enter Any Number:"))
if(num>0):
print("Number is positive")
elif(num<0):
print("Number is negative")
else:
print("Number is Zero")

B) DESCRIPTION:
Write a python program to print roots of a quadratic equation ax2 + bx +c=0
(where a≠0).Inputs: a=1 b= -5 c=6 Output: root1=3.0 root2=2.0

SOURCE CODE:
print("Equation: ax^2 + bx + c ")
a=int(input("Enter a: "))
b=int(input("Enter b: "))
c=int(input("Enter c: "))
d=b**2-4*a*c
d1=d**0.5
if(d<0):
print("The roots are imaginary. ")
else:
r1=(-b+d1)/2*a
r2=(-b-d1)/2*a
print("The first root: ",r1)
print("The second root: ",r2)

You might also like