0% found this document useful (0 votes)
9 views2 pages

Python Code for Area and Set Operations

Uploaded by

arthi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Python Code for Area and Set Operations

Uploaded by

arthi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

data_list = ['he','she','this','that','at']

new_list = []

while data_list:
minimum = data_list[0]
for x in data_list:
if x < minimum:
minimum = x
new_list.append(minimum)
data_list.remove(minimum)

print new_list
---------------------------------------------------------------------
class Shape:
def _init_(self,length,side):
[Link]=length;
[Link]=side;
def getinputforsquare(self):
[Link]=input("Enter side of square:");
[Link]=[Link];
def getinputforrect(self):
[Link]=input("Enter length of rectangle:");
[Link]=input("Enter side of rectangle:");
def findarea(self):
area=0;
class Square(Shape):
def _init_(self,length,side):
Shape._init_(self,length,side);
def findarea(self):
area=[Link]*[Link];
print "Area of square:",area;
class Rectangle(Shape):
def _init_(self,length,side):
Shape._init_(self,length,side);
def findarea(self):
area=[Link]*[Link];
print "Area of rectangle:",area;

a=Square()
b=Rectangle()
[Link]()
[Link]()
[Link]()
[Link]()
---------------------------------------------------------------------
a=set(['d','g','h','k','l']);
b=set(['g','j','i','o','p']);

x=[Link](b)
print x

x=[Link](b)
print x

x=[Link](b)
print x
x=[Link](a)
print x
x=a.symmetric_difference(b)
print x

---------------------------------------------------------------------
def func(lists):
print lists
sets=set(lists)
print sets
r=list(sets)
[Link]()
print r
lists=[1,29,12,24,35,24,88,120,155,88,120,155,200];
func(lists);

---------------------------------------------------------------------
customer_no=input("Enter the customer number:");
customer_name=raw_input("Enter the customer name:");
feets=input("Enter the number of feets:");

if(feets>=0)and(feets<=200):
charge=50*feets;
elif(feets>=201)and(feets<=300):
charge=100*feets;
elif(feets>=301)and(feets<=700):
charge=250*feets;
elif(feets>=701)and(feets<=1000):
charge=500*feets;
else:
charge=1000*feets;
print "Total charge :",charge;

You might also like