Mar-12-2024, 11:24 AM
hi
in the below snippet code :
thanks
in the below snippet code :
info1={'name':'ali', 'classroom':3}
info2={'name':'mohammad','classroom':2}
print('{0[name]} is in classroom {0[classroom]}.'.format(info1)) # 0 refers to info1
# note name and classroom in{} are without ''
print('{0[name]} is in classroom {0[classroom]} and {1[name]} is in classroom {1[classroom]}.'.format(info1,info2))
# 0 refers to info1 and 1 refers to info2 .how can break the lengthy last line(only with one format)?thanks
