Write the Python programs for the following: -
a) To find the perimeter of the rectangle whose length is 25 cm and breadth is 30 cm.
[p=2*(l+b)].
b) To find the area of parallelogram whose base is 30 cm and height is 45 cm. [a=b*h].
c) Take two variables x and y. Assign them the values 126 and 140 respectively.
Display the values of x and y variables using the print() statement.
d) Using the print() command display the message ‘Python is an Object- Oriented Programming Language’
on the IDLE Shell prompt.
e) To find the product of two numbers 95 and 15 by assigning it to the variables a and b.
Answers
Answered by
3
(a) To find the perimeter of the rectangle whose length is 25 cm and breadth is 30 cm.
Ans.
l = 25
b = 30
p = 2*(l+b)
print ("perimeter of the rectangle = ", p,"cm^2")
(b) To find the area of parallelogram whose base is 30 cm and height is 45 cm.
Ans.
b = 30
h = 45
a = b*h
print ("area of the parallelogram = ", a, "cm^2")
(c) Take two variables x and y. Assign them the values 126 and 140 respectively.
Ans.
x = 126
y = 140
(d) Using the print() command display the message ‘Python is an Object- Oriented Programming Language’.
Ans.
print ("Python is an Object- Oriented Programming Language")
(e) To find the product of two numbers 95 and 15 by assigning it to the variables a and b.
Ans.
a = 95
b = 15
product = a*b
print ("product of" ,a , "and" ,b, "=", product)
Similar questions