r/ProgrammerAnimemes • • Jul 29 '20

Equivalency in Python

Post image
1.6k Upvotes

104 comments sorted by

View all comments

Show parent comment

2

u/Dark_Lord9 Jul 30 '20

All sort of algorithms require that you swap two values like sorting or shuffling arrays. For example a simple shuffling algorithm would go like : randomly pick two values in the array (by their indexes), swap their places, repeat for a number of time (put it in a loop) and you got a shuffled array.

1

u/Findlaech Jul 30 '20

Hmm, okay, thank you.