Skip to content

Instantly share code, notes, and snippets.

View Nayemjaman's full-sized avatar

Nayem Jaman Tusher Nayemjaman

View GitHub Profile
"""
a = []
for i in range(13):
a.append(i)
print(a)
outPut:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
can convert this code in one line with
List Comprehension:
@Nayemjaman
Nayemjaman / class_getitem_sample.py
Created October 31, 2020 16:43
A sample demonstration of __getitem__ in python class
""" __getitem__ in class example """
class Person:
def __init__(self):
# self.num_info = (1, 2, 3, 4, 5)
self.info = {
'name': 'Nayem Jaman',
'country': 'Bangladesh',
'mobile': 1234569