Ip Record Work - Google Docs 2
Ip Record Work - Google Docs 2
RECORD
WORK
Done by : Fahma fathima
Program -1
Average of fivesubjects
AIM:
To find and display the average and grade for given marks for 5 different subject's
(each subject out of 100)
SOURCE CODE:
=int(input("Enter the number"))
a
b=int(input("Enter the number"))
c=int(input("Enter the number"))
d=int(input("Enter the number"))
e=int(input("Enter the number"))
avg=(a+b+c+d+e)/5
if (avg>=90):
print("A grade")
elif(avg>80 and avg<90):
print("B grade")
elif(avg>70 and avg<80):
print("C grade")
elif(avg>60 and avg<70):
print("D grade")
else:
print("F grade")
OUTPUT:
RESULT:
Successfully obtained the average for the given marks of five subjects using Python.
Program - 2
Sale price for the givenquantity
AIM:
To find the Sale price for given Quantity
SOURCE CODE:
rice=float(input("Enter Price : "))
p
DP=float(input("Enter discount % : "))
discount=price*DP/100
sp=price-discount
print("Cost Price : ",price)
print("Discount: ",discount)
print("Selling Price:",sp)
OUTPUT :
RESULT:
Successfully obtained the Sale price for a given quantity using Python.
Program - 3
Area/ Perimeter/Circumference
AIM:
To find the Area of a combination of different shapes.
SOURCE CODE:
s hape=str(input("Enter the name of shape:"))
if shape=="rectangle":
l=int(input("Enter rectangle's length:"))
b=int(input("Enter rectangle's breadth:"))
print(l*b)
elif shape=="square":
s=int(input("Enter square's side length: "))
print(s*s)
elif shape=="triangle":
h = int(input("Enter triangle's height length: "))
b = int(input("Enter triangle's breadth length: "))
print(0.5*b*h)
else:
print("Shape is not available")
OUTPUT:
RESULT:
Successfully obtained the Area of different shapes using Python.
rogram -4
P
ist (Biggest & Smallest)
L
AIM:
To find the biggest and smallest numbers in the created list.
SOURCE CODE:
l ist=(4,80,200,2,6,20,60,8)
max_value=max(list)
min_value=min(list)
print(max_value)
print(min_value)
OUTPUT:
RESULT:
Successfully obtained the biggest and smallest numbers in the created list using Python.
rogram -5
P
ictionary ( Minimum & Maximum value in the dictionary)
D
AIM:
To find the minimum and maximum in the dictionary
SOURCE CODE:
ict= {'x':330,'y':65,'z':400,'f':10,'g':95,'s':20,'j':50,'d':5}
d
max_value=max(dict)
min_value=min(dict)
print(max_value)
print(min_value)
OUTPUT:
RESULT:
uccessfully obtained the minimum and maximum from a created Dictionary using
S
Python.
rogram -6
P
Profit or Loss
IM:
A
To find whether its a Profit or Loss for a given Cost and Sell Price.
SOURCE CODE:
ostprice=float(input("Enter the cost price of an item :"))
c
sellingprice=float(input("Enter the selling price of an item :"))
if (sellingprice > costprice):
profit = sellingprice - costprice
print("Profit :",profit)
elif( costprice > sellingprice):
loss= costprice - sellingprice
print("Loss :" ,loss)
else:
print("No Profit No Loss")
OUTPUT:
RESULT:
Successfully obtained the Profit/ Loss of a given Cost and Sell price using Python.
rogram-7
P
umber of vowels in a string
N
AIM:
To find the number of vowels in the string
SOURCE CODE:
s entence = input('Enter a string:')
vowel = 'A,a,E,e,I,i,O,o,U,u'
Count = 0
for vowel in sentence:
Count += 1
print('There are {} vowels in the string: \'{}\''.format(Count,sentence))
OUTPUT:
RESULT:
Successfully obtained the Number of vowels in string using Python.
rogram-8
P
States & Capital
AIM:
To create a dictionary to accumulate states and capitals.
SOURCE CODE:
ict={}
d
n=int(input('Enter the limit'))
for i in range(n):
state=input('Enter the state:')
capital=input('Enter the capital:')
dict[state]=capital
print(dict)
OUTPUT:
RESULT:
uccessfully obtained states and capitals from the created dictionary using
S
Python.
Program-9
EMI (Equal monthly installment)
AIM:
To find a program to calculate EMI for Amount, Period and Interest.
SOURCE CODE:
mount=int(input('Enter the amount:'))
a
period=int(input('Enter the period(in
months):'))
interestrate=int(input('Enter the interest
rate:'))
interest=amount*period*interestrate/100
total=amount+interest
EMI=total/(period*12)
print('EMI amount:',EMI)
OUTPUT:
RESULT:
uccessfully obtained a program to calculate EMI for Amount, Period and
S
Interest using Python.
Program-10
To calculatetax
AIM:
To calculate the tax to be paid for each month
SOURCE CODE:
mount=int(input('Enter the amount: '))
A
if Amount>=10000 and Amount<=40000:
print('Tax amount to be paid: ',Amount*(2/100))
elif Amount>=40000 and Amount<=100000:
print('Tax amount to be paid: ',Amount*(5/100))
elif Amount>=100000 and Amount<=150000:
print('Tax amount to be paid: ',Amount*(7/100))
OUTPUT:
ESULT :
R
Successfully obtained tax to be paid for each month using Python.
rogram-11
P
um of squares of first 10 or 20 natural numbers.
S
IM:
A
To find the sum of squares of first 10 or 20 natural numbers.
SOURCE CODE:
um=0
s
for i in range(2,22):
sum+=i**2
print('sum of squares of the first 10 natural numbers:',sum)
OUTPUT:
RESULT:
uccessfully obtained the sum of squares of first 10 natural numbers using
S
Python.
Program -12
Multiples of given numbers.
IM:
A
To find the multiples of given numbers.
OURCE CODE:
S
n=int(input('Enter the limit'))
for i in range(1,n+1):
multiple=n*i
print(multiple)
OUTPUT:
RESULT:
Successfully obtained the multiples of given numbers using Python.
rogram-13
P
ords starting with the same Alphabet
W
AIM:
To find the words starting with the same alphabet.
SOURCE CODE:
=input('Enter the sentence')
a
b=input('Enter the alphabet')
for i in a.split():
if i[0]==b:
print(i)
OUTPUT:
ESULT:
R
Successfully obtained the words starting with the same alphabet using
Python.
rogram-14
P
umber of occurrences of a given alphabet (count)
N
IM:
A
To find the number of occurrences of a given alphabet.
OURCE CODE:
S
count = 0
my_string = "fahma fathima"
my_char = "a"
for i in my_string:
if i == my_char:
count += 1
print(count)
OUTPUT:
ESULT:
R
Successfully obtained the number of occurrences of a given alphabet using
Python.
rogram -15
P
ind whether number positive ,negative or zero
F
AIM:
To find whether the number is positive , negative or zero
OURCE CODE:
S
number = int(input("Enter a number: ")
if number > 0:
print("Number is positive")
elif number < 0:
print("Number is negative")
else:
print("Number is zero")
OUTPUT:
ESULT:
R
Successfully obtained whether the number is positive , negative or zero .