Slip 16 A)
Write a python script to create a class Rectangle with data member’s length,
width and methods area, perimeter which can compute the area and perimeter of
rectangle.
Answer :
class Rect:
def
__init__(self,l2,w2):
self.l=l2
self.w=w2
def
RectArea(self):
self.a=self.l
* self.w
print("Area
of Rectangle:", self.a)
def
RectPer(self):
self.p=2*(self.l
+ self.w)
print("Perimeter
of Rectangle:", self.p)
#main body
l1=int(input("Enter Length:"))
w1=int(input("Enter Width:"))
Obj=Rect(l1,w1)
Obj.RectArea()
Obj.RectPer()
Output :
Slip 16 B)
Write Python GUI program to add items in listbox widget and to print and delete
the selected items from listbox on button click. Provide three separate buttons
to add, print and delete.
Answer :
Output :
No comments:
Post a Comment