This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" __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 |