I am looking for a function or short program that receives a string (up to 10 letters) and shuffles it.
In Python, you can shuffle (= randomize) a list, string, and tuple with random.
Python Random shuffle() Method The shuffle() method takes a sequence, like a list, and reorganize the order of the items. Note: This method changes the original list, it does not return a new list.
>>> import random >>> s="abcdef123" >>> ''.join(random.sample(s,len(s))) '1f2bde3ac'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With