+ 3
why does the following code show a syntax error in line 16
import random class VagueList: def __init__(self, cont): self.cont = cont def __getitem__(self, index): return self.cont[index + random.randint(-1, 1)] def __len__(self): return random.randint(0, len(self.cont)*2) vague_list = VagueList(["A", "B", "C", "D", "E"]) print(len(vague_list)) print(len(vague_list)) For a in vague_list : print(a) print(vague_list[2]) print(vague_list[2])
3 Respostas
+ 1
Don't use capital letter for For change to for.
+ 1
😅
+ 1
thnx