CJCoding With Joseph
15free / daySign inCreate account

Swap Two Names

Exchange the elements at index 1 and index 3 of the list names with a temporary string variable called temp so neither name is lost. Then print the whole list, and on a second line print <a> and <b> have swapped where <a> is the new element at index 1 and <b> the new element at index 3. No input is read.

Expected Output:

['Giselle', 'Lena', 'Omar', 'Maya', 'Theo']
Lena and Maya have swapped

= newline. The output ends with a newline — print one after the last line.

Hints3 available
Topics:
ListsVariables
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.