Professional Documents
Culture Documents
practicalXII2025gdgawefe
practicalXII2025gdgawefe
practicalXII2025gdgawefe
Aim: To find out compound interest on given principle, rate and time
using function
Date: 03-05-2024
Developed By: your name
Mentor: Pradumna Singh Sir
def compint(p,r,t):
ci=(p*(1+(r/100))**t)-p
return ci
#main program
p=float(input('Enter principle:--'))
r=float(input('Enter rate:--'))
t=float(input('Enter time:--'))
CI=compint(p,r,t)
print('Compound Interest is ',CI)
SAMPLE OUTPUT 1:
Enter principle:--1000
Enter rate:--10
Enter time:--1
Compound Interest is 100.0
SAMPLE OUTPUT 2:
Enter principle:--1000
Enter rate:--10
Enter time:--2
Compound Interest is 210.00000000000023
PRACTICAL-2
Aim: WAF to check whether the given number is an Armstrong number
or not.
Date: 06-05-2024
Developed By: your name
Mentor: Pradumna Singh Sir
SAMPLE OUTPUT 1:
Enter any integer:--153
153 is an armstrong number
SAMPLE OUTPUT 2:
Enter any integer:--657
657 is not an armstrong number
PRACTICAL-3
Aim: Write a function REP which accepts a list of integers and its size as
arguments and replaces elements having even values with its half and
elements having odd values with twice its value.
Eg: if the list contains 3, 4, 5, 16, 9 then the function should rearranged
list as 6, 2,10,8, 18
Date: 08-05-2024
Developed By: your name
Mentor: Pradumna Singh Sir
def REP(L,S):
for i in range(S):
if L[i]%2==0:
L[i]=L[i]//2
else:
L[i]=L[i]*2
return L
#main program
l=[]
n=int(input('Enter size of list:--'))
print('Enter ',n,' numbers:--')
for i in range(n):
l.append(int(input()))
print('Original list is:',l)
L=REP(l,n)
print('Resultant list is:',L)
PRACTICAL-4
Aim: To write a function that receives tuple as its argument containing N
integers. Find out the greatest and smallest number present in tuple.
Invoke the function in main program.
Date: 10-05-2024
Developed By: your name
Mentor: Pradumna Singh Sir
OUTPUT:
Enter size of tuple:--6
Enter 6 numbers:--
56
23
90
56
34
96
Data in tuple are:-
56.0 23.0 90.0 56.0 34.0 96.0
Greatest Number: 96.0
Smallest Number: 23.0
PRACTICAL-5
Aim: Write a function in Python to count and assign the frequency of
words in the given string using a dictionary.
Date: 13-05-2024
Developed By: your name
Mentor: Pradumna Singh Sir
def frequency(S):
words=S.split()
d={}
for i in words:
key=i
if key not in d:
c=words.count(key)
d[key]=c
for i in d:
print(i,'--',d[i])
#main program
S=input("Enter any string:--")
frequency(S)
SAMPLE OUTPUT:
Enter any string:--i love my country i love my mom too
i -- 2
love -- 2
my -- 2
country -- 1
mom -- 1
too -- 1