how to swap list value in python code example
Example 1: swap two elements in a list python
i = ['title', 'email', 'password2', 'password1', 'first_name',
'last_name', 'next', 'newsletter']
a, b = i.index('password2'), i.index('password1')
i[b], i[a] = i[a], i[b]
Example 2: how to swap in list in python
list[pos1], list[pos2] = list[pos2], list[pos1]