0% found this document useful (0 votes)
7 views9 pages

Untitled Document

Uploaded by

Omkar Kamtekar
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)
7 views9 pages

Untitled Document

Uploaded by

Omkar Kamtekar
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/ 9

1.

to write a python program to find the area of


rectangle,square,circle and triangle by accepting the
suitable input parameters from the users.
I.area of rectangle

print("area of rectangle")
a=int(input("enter the length="))
w=int(input("enter the width="))
print("area of the rectangle=",(a*w))

Output:

area of rectangle
enter the length=20
enter the width=25
area of the rectangle= 500

2.area of square

print("area of square")
s=int(input("enter the length of the side="))
print("area of sqaure=",(s*s))

Output:
area of square
enter the length of the side=15
area of sqaure= 225

3.area of circle
print("area of circle")
r=int(input("enter the radius of circle="))
print("area of circle=",(3.14*r*r))

Output:
area of circle
enter the radius of circle=8
area of circle= 200.96

4.area of triangle
print("area of triangle")
h=int(input("enter the height="))
b=int(input("enter the base="))
print("area of triangle=",(0.5*b*h))

Output:
area of triangle
enter the height=20
enter the base=10
area of triangle= 100.0

2. To write a python program to convert the given


temperature from fahrenheit to celsius and vice
versa upon the users demand.

Coding:
print("temperature conversion")
print("a=from fahrenhit to celcius")
print("b=from celcius to fahrenheti")
choice=input("enter your choice (a/b):")
t=float (input("enter the temperature:"))
if choice.lower()=='a':
print("fahrenheti to calcius:", (t-32)*5/9)
else:
print("celcius to fahrenheit:", (t*9/5)+32)
Output:
temperature conversion
a=from fahrenhit to celcius
b=from celcius to fahrenheti
enter your choice (a/b):a
enter the temperature:470
fahrenheti to calcius: 243.33333333333334

temperature conversion
a=from fahrenhit to celcius
b=from celcius to fahrenheti
enter your choice (a/b):b
enter the temperature:120
celcius to fahrenheit: 248.0

3. Calculate simple and compound


interest.

Coding:
p=int(input("enter the principal
amount"))
n=int(input("enter the time"))
r=int(input("enter the rate of intrest"))
SI=p*n*r/100
CI=p*1+r/100*n
print(CI)
Output:

enter the principal amount5000


enter the time2
enter the rate of intrest18
5000.36

4.to write a python program to calculate


total marks,percentage and grade of a
student.
"wap to calculate total marks,percentage
and grade of a student.(using elif)"
a=float(input("enter your marks eng:"))
b=float(input("enter your marks dbms:"))
c=float(input("enter your marks
computer science:"))
d=float(input("enter your marks os:"))
e=float(input("enter your marks iks:"))
s=a+b+c+d+e
p=s/500*100
if P>=90:
print("your grade is:a")
elif p>=80:
print("your grade is:b")
elif p>=70:
print("your grade is:c")
elif p>60:
print("your grade is :d")
elif p>=50:
print("your grade is:e")
else:
print("your grade is:f")
print("total marks are:",s)
print("total percentage are:",p,"%")

Output:
enter your marks eng:77
enter your marks dbms:88
enter your marks computer science:76
enter your marks os:96
enter your marks iks:100
your grade is:b
total marks are:437.0
total percentage are :87.4%

5.check given number is odd or even.

#get the number from the user


num=int(input("enter a numbr:"))

#check if the number is even or odd


if num%2==0:
print(num,"is an even number.")
else:
print(num,"is an odd number.")

Output:
enter a numbr:13
13 is an odd number.

6.print 1 to 10 numbers

for i in range(1,11):
print(i)
Output:
1
2
3
4
5
6
7
8
9
10

You might also like