[Solved] How do I print a blank line whenever the first letter of the state differs from the previous state’s first letter [closed]


If you need to compare with other members, don’t use the for-each loop.

for i in range(len(states_list)):
     if i > 0:
         if states_list[i][0] != states_list[i-1][0]:
             print('\n')
     print(states_list[i])

2

solved How do I print a blank line whenever the first letter of the state differs from the previous state’s first letter [closed]