Question: **USE PYTHON ONLY** Define a vector of integers with 5 elements. Write the following function Given a vector and two indexes, returns a vector where

**USE PYTHON ONLY**

Define a vector of integers with 5 elements.

Write the following function

Given a vector and two indexes, returns a vector where the values at the provided indexes are swapped

Example

Input: my_vector = [40,51,62,73,84,95]

Invoke function: swap(my_vector, 2, 4)

Output: [40,51,84,73,62,95]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!