Mixing It Up

--Originally published at PYTHON 3

In this code we are going to learn how to turn a string object into a list and also how to make a total new sentence by mixing up in a random order all the characters in it.

First we need to import the random library, then the sentence we want to mix up, it may be an input but in this program I’ve wrote already a sentence.

sentence = “one two three four five six seven, all good children go to heaven”

to make this sentence into a list we do the next

sentence_list = list(sentence)

and like the program before we need a en empty string object

mix = “”

next we do a for,

for each letter in our range of the list from 0 to the length of list, our empty string named mix will be added a random character from the list.

and to end these we just print it, here is the final result.

screenshot-from-2016-10-15-19-43-11

screenshot-from-2016-10-15-19-43-41

?