+ 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])

29th Jun 2018, 4:36 AM
Raghav Naswa
Raghav Naswa - avatar
3 Answers
+ 1
Don't use capital letter for For change to for.
29th Jun 2018, 4:41 AM
Louis
Louis - avatar
+ 1
😅
29th Jun 2018, 4:44 AM
Raghav Naswa
Raghav Naswa - avatar
+ 1
thnx
29th Jun 2018, 4:44 AM
Raghav Naswa
Raghav Naswa - avatar