0
A doubt in this attached code !!
I'm unable to understand the output of the code. https://code.sololearn.com/cnaFH1zCuojl/?ref=app
3 Réponses
+ 3
Well, it basicall works on random choices to print outputs.
Actually, a class vague_list was made with 3 functions, dont forget your initialization. The first function prints the length of the list but on a random note. The dunder(magic method) __len__ gets called whenever a len function is used e.g
class Lists...
def __len__:
return len(Lists)
print(len(Lists(a,b,c,d)))
The result is 4.
The dunder for indexing a list is __getItem__
NOTE: The code works on random choice, so the outputs are not true.
Also, the code I wrote here has some errors. Just ignore them
I hope you understand
+ 3
You welcome bro.
+ 1
Got it dude and thanks