We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9155a5e commit 01de727Copy full SHA for 01de727
OOPS/__getitem__01.py
@@ -0,0 +1,11 @@
1
+class Indexer:
2
+ def __init__(self):
3
+ pass
4
+ def __getitem__(self,index):
5
+ return index**2
6
+obj=Indexer()
7
+print(obj[4])
8
+'''
9
+output:
10
+16
11
0 commit comments