Python Shuffle

Main.PythonShuffle History

Hide minor edits - Show changes to markup

May 04, 2007, at 12:08 AM EST by verbal -
Changed line 4 from:
  1. shuffle2.py by Verbal
to:
  1. shuffle2.py by Verbal
Changed lines 9-10 from:

cl = list(orig) random.shuffle(cl)

to:

listb = list(orig) random.shuffle(listb)

Changed lines 12-13 from:
  1. print cl

cl2 = "".join(cl)

to:
  1. print listb

listc = "".join(listb)

Changed line 15 from:

print " new string = ", cl2

to:

print " new string = ", listc

May 03, 2007, at 11:59 PM EST by verbal -
Changed lines 4-5 from:
  1. shuffle2.py shuffle ( randomly mix ) a string of 6 charcters
  2. by Verbal
to:
  1. shuffle2.py by Verbal
  2. shuffle ( randomly mix ) a string of 6 charcters
May 03, 2007, at 11:56 PM EST by verbal -
Added lines 1-16:
#!/usr/bin/python
#
#  shuffle2.py  shuffle ( randomly mix ) a string of 6 charcters
#     by Verbal
#
import random
orig = "abcdef"
cl   = list(orig)
random.shuffle(cl)
#   uncomment the line below to see the shuffled characters as a list
#print cl
cl2 = "".join(cl)
print "original string = ", orig
print "     new string = ",  cl2