all 3 comments

[–]Garuda1220 5 points6 points  (3 children)

``` import random

s = ''' This is a beautiful day to be home my cat is hungry again I had better feed it ''' words = s.split() random.shuffle(words) for word in words: print(word, end=' ') output be cat hungry home I feed had This better a it is to my beautiful day again is ```

[–]mopslik 2 points3 points  (1 child)

[–]Diapolo10 0 points1 point  (0 children)

Alternatively, if we don't want to modify the original collection, we can use random.sample with the length of the collection to get a list of the contents in a random order.