Example 1: best python compilers
Check this! https://dev.to/devlorenzo/best-python-compilers-online-ide-2koe
Example 2: python compiler
class Boutique():
def __init__(self,id,bname,btype,brating,points):
self.boutiqueid = bid
self.boutiquename = bname
self.boutiquetype = btype
self.boutiquerating = brating
self.points = points
class OnlineBoutique():
def __init__(self,bdict):
self.boutiqueDict = bdict
def getboutique(self,rll,rul,ep,typ):
res = []
for i in self.boutiqueDict.keys():
if i.lower() == typ.lower():
for x in boutiqueDict[i]:
if rll <= x.boutiquerating and x.boutiquerating <= rul:
x.points += ep
res.append(x)
if len(res) == 0: return None
else: return res.sort(lambda x:x.points, reverse = True)
#main
n = int(input())
bdict ={}
lis =[]
for i in range(n):
bid = int(input())
bname = input()
btype = input()
brating = float(input())
obj = Boutique(bid,bname,btype,brating,points)
if btype in bdict.keys():
bdict[btype].append(obj)
else:
bDdct[btype] = [obj]
myobj = OnlineBoutique(bdict)
typ = input()
blist = myobj.getboutique(rll,ull,ep,typ)
for b in blist:
print(b.boutiqueid, b.name, b.points)
print(bDict)class Boutique:
def init(self,bid,name,btype,rating,point):
self.boutiqueid = int(bid)
self.boutiquename = str(name)
self.boutiquetype = str(btype)
self.boutiquerating = float(rating)
self.points = int(point)
class OnlineBoutique:
def init(self,l):
self.diff_type = []
for i in range(len(l)):
if l[i].boutiquetype not in self.diff_type:
self.diff_type.append(l[i].boutiquetype)
self.boutiquedict = {}
for j in range(len(self.diff_type)):
self.boutiquedict[self.diff_type[j]] = []
for k in range(len(l)):
self.boutiquedict[l[k].boutiquetype].append(l[k])
def getBoutique(self,lower_rate,upper_rate,extra_point,btype):
self.fin_list = []
types = list(self.boutiquedict.keys())
if btype not in types:
return self.fin_list
else:
for i in range(len(self.boutiquedict[btype])):
self.fin_list.append(self.boutiquedict[btype][i])
if lower_rate <= self.boutiquedict[btype][i].boutiquerating <= upper_rate:
self.boutiquedict[btype][i].points += extra_point
for j in range(len(self.fin_list) -1):
for k in range(0, len(self.fin_list) - j - 1):
if self.fin_list[k].points > self.fin_list[k+1].points:
self.fin_list[k].points, self.fin_list[k+1].points = self.fin_list[k+1].points,self.fin_list[k].points
return self.fin_list[::-1]
if name == "__main__":
n = int(input())
l = []
for i in range(n):
l.append(Boutique(input(),input(),input().lower(),input(),input()))
OnlineBoutique1 = OnlineBoutique(l)
low = float(input())
upp = float(input())
btype = str(input()).lower()
fin = OnlineBoutique1.getBoutique(low,upp,extra,btype)
if fin == None:
print("No boutique found")
else:
for i in range(len(fin)):
print(f"{fin[i].boutiqueid} {fin[i].boutiquename} {fin[i].points}")
ob_obj = OnlineBoutique(bDict)
rll = float(input())
rul = float(input())
ep = int(input()
typ = input()
ans = ob_obj.getboutique(rll,rul,ep,typ)
if ans is None:
print("No boutique found")
else:
for i in ans:
print(i.boutiqueid,i.boutiquename,i.points)
Example 3: python compilers
Check this article: https://dev.to/devlorenzo/best-python-compilers-online-ide-2koe