fork(1) download
  1. class LetterList:
  2. def __init__(self, n): self.n = n
  3. def __len__(self): return self.n
  4. def __getitem__(self, i): return chr(ord('A') + i)
  5.  
  6. x = LetterList(3)
  7. print(x[0], x[1], x[2])
Success #stdin #stdout 0.02s 9308KB
stdin
Standard input is empty
stdout
A B C