0

Im trying to print out a list of user input after its been shuffled. Instead of printing the list it prints "none". What am I doing wrong?

import random 

x = raw_input("Write one word: ")
word1 = x
y = raw_input("Write another word: ")
word2 = y
z = raw_input("Write one more word: ")
word3 = z

all_words = [word1, word2, word3] 
random_words = random.shuffle(all_words)

print random_words
DavidK
  • 299
  • 1
  • 6
  • 24
  • 1
    Please check the Python documentation. From the documentation: "Shuffle the sequence x in place.". That's it. – Right leg Nov 04 '16 at 05:07

1 Answers1

1

random.shuffle mutates the input list and returns None. If you print all_words, you'll see a shuffled list.

mgilson
  • 300,191
  • 65
  • 633
  • 696
  • Thanks for marking my question as a duplicate now I cant ask anymore questions. What a great learning environment SO is! So welcoming!!! – DavidK Nov 06 '16 at 01:43