Tuesday, 19 September 2017

How to declare and iterate arrays and map ?






DECLARING LIST AND MAP
list = [ item1, item2, item3 ]
map = { key1:value1, key2:value2, key3:value3 }


EXAMPLES

sharks = ['s1', 's2', 's3']
for shark in sharks:
    print(shark)

emp = {'name' : 'shaan', 'age' : '35'}
for key in emp:
    print(key + ' = ' + emp[key])



OUTPUT
s1
s2
s3
name = shaan
age = 35

 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.