num = [1,2,2,3,3,4,4,4,4,4]
# # for statement
for n in num:
print(n)
# # dictionary
d = { 'a': 1, 'b': 2 }
# # exist or not exist in a dictionary
print('a' in d) # True
print('c' in d) # False
print('c' not in d) # True
# # set k-v to a dict
d['c'] = 3
print('c' in d) # True
# # if-else statement
if ('c' not in d):
print('c is not exist in a dict')
else:
# # get a value from a dict
print(d['c']) # 3
# # increment
d['c'] += 1
print(d['c']) # 4
You can combine the individual grammar above.
© 2025 OneMinuteCode. All rights reserved.