Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write recursive code for the following problem using python 3.2+. Write a functi

ID: 3828089 • Letter: W

Question

Write recursive code for the following problem using python 3.2+.

Write a function q8() that accepts a List as a parameter and scrambles the List into a random order, like shuffling a deck of cards. The function must complete this process without using the random library or any other built-in Python 'shuffling' method or function then return the resulting List. Examples: (your shuffled results will obviously differ ellipsis) q8() ([1, 2, 3, 4, 5, 6]) [6, 2, 4, 5, 1, 3] q8 (['Jane' 'June' 'Jon' 'Joe']) ['Jon', 'Joe', 'June', 'Jane'] q8[2.5, 5.25, 7, 8.25, '2.5']) ['2.5', 7, 5.25, 2.5, 8.25]

Explanation / Answer

Result:

>>> arr=[0, 1,3,4,6,7,8,9];
>>> q8(arr)
>>> arr
[8, 3, 9, 6, 1, 7, 4, 0]
>>> arr=['June','July','Feb','Mar','Aug'];
>>> q8(arr)
>>> arr
['Mar', 'June', 'July', 'Feb', 'Aug']
>>>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote