class points():
def __init__(self,a1,b1,c1,d1):
self.a1=a1
self.b1=b1
self.c1=c1
self.d1=d1
def plot(self):
xs=[self.a1[0],self.b1[0],self.c1[0],self.d1[0]]
ys=[self.a1[1],self.b1[1],self.c1[1],self.d1[1]]
print(xs)
print(ys)
colors=['c','m','b','y']
a1=points([1,2],[2],[3,4],[4,5])
a1.plot()
How to define a default list so that when I am not providing value to b1[1] , it doesn't give error?
listdoesn't have a counterpart todict.get. Either validate that a correct list is assigned toself.b1in the first place, or handle the possibleIndexErrorinpoints.plot.