HeidiHeff

Random Words

Nov 12th, 2012
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. # random_words.py
  2. # Random Words
  3. #
  4. # Computer prints a list of words in random order, not repeating any
  5. #
  6. # Heidi Heffelfinger
  7. # November 1, 2012
  8. # Programming Python for the Absolute Beginner 3rd Ed. Chapter 5
  9. # Challenge 1
  10.  
  11. # import modules
  12. import random
  13.  
  14. # create list
  15. word_list = ["bunny", "rabbit", "hare", "buck", "coney",
  16.          "cottontail", "cuniculus", "doe", "lagomorph", "lapin"]
  17.  
  18. while word_list != []:
  19.     word = random.choice(word_list)
  20.     print(word)
  21.     word_list.remove(word)
  22.  
  23. input("\n\nPress the enter key to exit.")
Advertisement
Add Comment
Please, Sign In to add comment