how to swap two elements of a list python code example
Example: 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]