0% found this document useful (0 votes)
58 views

IP Prac

The document contains the practical file submitted by Sourabh Srivastva of class XI Science A to their teacher Mr. Akshay Varshney of Army Public School Amritsar for the subject Informatics Practices, listing 15 programming practical problems solved ranging from calculating averages and grades to finding sums of squares and creating dictionaries.

Uploaded by

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

IP Prac

The document contains the practical file submitted by Sourabh Srivastva of class XI Science A to their teacher Mr. Akshay Varshney of Army Public School Amritsar for the subject Informatics Practices, listing 15 programming practical problems solved ranging from calculating averages and grades to finding sums of squares and creating dictionaries.

Uploaded by

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

ARMY PUBLIC SCHOOL AMRITSAR

SESSION 2021-22

PRACTICAL FILE

INFORMATICS PRACTICES (065)

SUBMITTED TO: SUBMITTED BY:


MR. AKSHAY VARSHNEY SOURABH SRIVASTVA

22760

XI SCI-A
INDEX

S no. Title of Practical Page no. Sign


1 To find average and grade for given marks. 1-2

To find the sale price of an item with a given cost and


2 3-4
discount (%).
To calculate perimeter/circumference and area of shapes
3 5-7
such as triangle, rectangle, square and circle.

4 To calculate Simple and Compound interest. 9-10

5 To calculate profit-loss for a given Cost and Sell Price. 11-12

To calculate EMI for Amount, Period and


6 13-14
Interest.

7 To calculate tax - GST / Income Tax. 15-17

8 To find the largest and smallest numbers in a list. 19-20

9 To find the third largest/smallest number in a list. 21-22

10 To find the sum of squares of the first 100 natural numbers. 23-24

11 To print the first ‘n’ multiples of a given number. 25-26

12 To count the number of vowels in a user entered string. 27-28

To print the words starting with a particular alphabet in a


13 29-30
user entered string.
To print the number of occurrences of a given alphabet in a
14 31-32
given string.
Create a dictionary to store names of states and their
15 33-34
capitals.
OUTPUT (Practical - 1)

Enter marks of the first subject : 82


Enter marks of the second subject : 76
Enter marks of the third subject : 59
Enter marks of the fourth subject : 97
Enter marks of the fifth subject : 64
Average : 75.6
Grade : B+

1
INPUT (Practical - 1)

sub1 = int(input("Enter marks of the first subject : "))


sub2 = int(input("Enter marks of the second subject : "))
sub3 = int(input("Enter marks of the third subject : "))
sub4 = int(input("Enter marks of the fourth subject : "))
sub5 = int(input("Enter marks of the fifth subject : "))

avg = (sub1 + sub2 + sub3 + sub4 + sub5) / 5


print("Average :", avg)

if(avg >= 90):


    print("Grade : A +")
elif(avg >= 85 and avg < 90):
    print("Grade : A")
elif(avg >= 80 and avg < 85):
    print("Grade : A-")
elif(avg >= 75 and avg < 80):
    print("Grade : B+")
elif(avg >= 70 and avg < 75):
    print("Grade : B")
elif(avg >= 65 and avg < 70):
    print("Grade : C+")
elif(avg >= 60 and avg < 65):
    print("Grade : C")
elif(avg >= 55 and avg < 60):
    print("Grade : D+")
elif(avg >= 50 and avg < 55):
    print("Grade : D")
elif(avg >= 40 and avg < 50):
    print("Grade : E")
elif(avg >= 0 and avg < 40):
    print("Grade : F")
else:
    print("Error! Can't generate grade")

2
OUTPUT (Practical - 2)

Enter Price (₹) : 200


Enter discount % : 18
Selling Price : ₹164.0

3
INPUT (Practical - 2)

price = float(input("Enter Price (₹) : "))


discount_percentage = float(input("Enter discount % : "))
discount = price * discount_percentage / 100
sale_price = price - discount

print("Selling Price : ₹{0}".format(sale_price))

4
OUTPUT (Practical - 3)

Select a shape :-
(a) Triangle
(b) Rectangle
(c) Square
(d) Circle

=> d
Enter the radius of circle : 14
Area of circle : 615.44
Circumference of circle : 87.92

5
INPUT (Practical - 3)

PI = 3.14

def square(s):
    area = float(s*s)
    print("Area of square :", area)
    peri = float(4*s)
    print("Perimeter of square :", peri)

def circle(r):
    area = float(PI*r**2)
    print("Area of circle :", area)
    peri = float(2*PI*r)
    print("Circumference of circle :", peri)

def rectangle(l, b):


    area = float(l*b)
    print("Area of rectangle :", area)
    peri = float(2*(l + b))
    print("Perimter of rectangle :", peri)

def triangle(b, h):


    area = float((h*b)/2)
    print("Area of triangle :", area)
    hyp = float((h**2 + b**2)**(0.5))
    peri = float(h + b + hyp)
    print("Perimter of right angled triangle :", peri)

print('''
Select a shape :-
(a) Triangle
(b) Rectangle
(c) Square
(d) Circle
''')

usr_inp = input("=> ")

6
if usr_inp == "a":
    b=float(input("Enter the base of right angled triangle : "))
    h=float(input("Enter the height of right angled triangle : "))
    triangle(b, h)

elif usr_inp == "b":


    l = float(input("Enter the length of rectangle : "))
    b = float(input("Enter the breadth of rectangle : "))
    rectangle(l, b)

elif usr_inp == "c":


    s = float(input("Enter the side of square : "))
    square(s)

elif usr_inp == "d":


    r = float(input("Enter the radius of circle : "))
    circle(r)

else:
    print("Invalid Option!")

7
8
OUTPUT (Practical - 4)

Enter Principal (₹) : 5000


Enter Time : 8
Enter Rate : 14
Simple Interest : ₹5600
Compound Interest : ₹9263

9
INPUT (Practical - 4)

P = float(input("Enter Principal (₹) : "))


T = float(input("Enter Time : "))
R = float(input("Enter Rate : "))

SI = (P*R*T)/100
CI = P*((1 + R/100)**T - 1)

print("Simple Interest : ₹{0}".format(round(SI)))


print("Compound Interest : ₹{0}".format(round(CI)))

10
OUTPUT (Practical - 5)

Enter the Cost Price (₹) : 500


Enter the Selling Price (₹) : 650
Total Profit : ₹150.0

11
INPUT (Practical - 5)

CP = float(input("Enter the Cost Price (₹) : "))


SP = float(input("Enter the Selling Price (₹) : " ))
 
if(CP > SP):
    amount = CP - SP
    print("Total Loss : ₹{0}".format(amount))
elif(CP < SP):
    amount = SP - CP
    print("Total Profit : ₹{0}".format(amount))
else:
    print("Break-even point! (No Profit No Loss)")

12
OUTPUT (Practical - 6)

Enter Principal Amount (₹) : 8000


Enter Annual Interest Rate : 14
Enter Number of Months : 18
Equated Monthly Installment (EMI) : ₹495

13
INPUT (Practical - 6)

P = float(input("Enter Principal Amount (₹) : " ))


R = float(input("Enter Annual Interest Rate : "))
n = int(input("Enter Number of Months : "))

r = R/(12*100)

EMI = P*r*((1 + r)**n) / ((1 + r)**n - 1)

print("Equated Monthly Installment (EMI) : ₹{0}".format(round(EMI)))

14
OUTPUT (Practical - 7)

Select what to calculate :-


(a) GST
(b) Income Tax

=> b
Enter your Taxable Income (₹) : 800000
Income Tax : ₹160000.0 (20%)

15
INPUT (Practical - 7)

print('''
Select what to calculate :-
(a) GST
(b) Income Tax
''')

usr_inp1 = input("=> ")

if usr_inp1 == "a":
    cost = float(input("Enter Original Cost (₹) : "))

    print('''
Select GST Rate :-
(a) 5%
(b) 12%
(c) 18%
(d) 28%
    ''')

    usr_inp2 = input("=> ")

    if usr_inp2 == "a":
        GST_rate = 5

    elif usr_inp2 == "b":


        GST_rate = 12

    elif usr_inp2 == "c":


        GST_rate = 18

    elif usr_inp2 == "d":


        GST_rate = 28

    else:
        print("Invalid Option!")

    GST_Amount = (cost * GST_rate) / 100


    print("GST Amount : ₹{0}".format(GST_Amount))

16
if usr_inp1 == "b":
    usr_inp3 = float(input("Enter your Taxable Income (₹) : " ))

    if usr_inp3 <= 250000:


        IT_rate = 0

    elif usr_inp3 > 250000 and usr_inp3 <= 500000:


        IT_rate = 5

    elif usr_inp3 > 500000 and usr_inp3 <= 1000000:


        IT_rate = 20

    elif usr_inp3 > 1000000:


        IT_rate = 30
   
    IT = (usr_inp3 * IT_rate) / 100

    print("Income Tax : ₹{0} ({1}%)".format(IT, IT_rate))

17
18
OUTPUT (Practical - 8)

Smallest number : -10


Largest number : 10

19
INPUT (Practical - 8)

list1 = [-10, -5, 0, 5, 10]

min_value = min(list1)
max_value = max(list1)

print('''
Smallest number : {0}
Largest number : {1}
'''.format(min_value, max_value))

20
OUTPUT (Practical - 9)

24

21
INPUT (Practical - 9)

list1 = [6, 61, 98, 24, 19]


n = 3

x = sorted(list1)[-n]
print(x)

22
OUTPUT (Practical - 10)

Sum of squares of first 100 natural numbers : 338350

23
INPUT (Practical - 10)

n = 100

sum = 0
for i in range(n+1):
    sum += i**2

print("Sum of squares of first 100 natural numbers :", sum)

24
OUTPUT (Practical - 11)

Enter a number : 8
Enter number of multiples : 10
Multiples are : 8 16 24 32 40 48 56 64 72 80

25
INPUT (Practical - 11)

def multiple(num, n):


    print("Multiples are :", end=" ")
    for i in range(1, n+1):
        print(num*i, end=" ")

num = int(input("Enter a number : "))


n = int(input("Enter number of multiples : "))

multiple(num, n)

26
OUTPUT (Practical - 12)

Enter a String : Hello how are you?


Number of vowels : 7

27
INPUT (Practical - 12)

def count_vowel(str):
    c = 0
    v = "aeiouAEIOU"
     
    for a in str:
        if a in v:
            c += 1
     
    print("Number of vowels :", c)
     
string = input("Enter a String : ")
 
count_vowel(string)

28
OUTPUT (Practical - 13)

Enter a String : I love India


Enter a Alphabet : I
I
India

29
INPUT (Practical - 13)

string = input("Enter a String : ")


a = input("Enter a Alphabet : ")

for i in string.split():
    if i.startswith(a):
        print(i)

30
OUTPUT (Practical - 14)

Enter a String : Hello how are you?


Enter a Alphabet : o
Count of o in Hello how are you? is : 3

31
INPUT (Practical - 14)

string = input("Enter a String : ")


a = input("Enter a Alphabet : ")

c = 0

for i in string.lower():
    if i == a:
        c += 1

print ("Count of {0} in {1} is : {2}".format(a, string, c))

32
OUTPUT (Practical - 15)

Enter number of entries : 3


State (1) : Delhi
Capital (1) : New Delhi
State (2) : Punjab
Capital (2) : Amritsar
State (3) : Assam
Capital (3) : Dispur
{'Delhi': 'New Delhi', 'Punjab': 'Amritsar', 'Assam': 'Dispur'}

33
INPUT (Practical - 15)

n = int(input("Enter number of entries : "))

states, capitals = [], []

for i in range(n):

    state = input("State ({0}) : ".format(i+1))


    capital = input("Capital ({0}) : ".format(i+1))
    states.append(state)
    capitals.append(capital)

dictionary = dict(zip(states, capitals))


print(dictionary)

34

You might also like