Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

Word Scrabbler - Completely Random - Python Code Bank


Word Scrabbler - Completely Random
This simple python script I wrote takes a single word provided on the cmd line and outputs a scrabbled version - It Is As Simple As That
                import random
import sys
import string

numberArgs = len(sys.argv)

if numberArgs == 1:
    print "Usage: " + sys.argv[0] + " [word to scramble]"
elif numberArgs == 2:
    toScramble = sys.argv[1]
    letterList = list(toScramble)
    random.shuffle(letterList)
    stringScrambled = ''.join(letterList)

    while (stringScrambled == toScramble):
        letterList = list(toScramble)
        random.shuffle(letterList)
        stringScrambled = ''.join(letterList)

    print "Your Word '" + toScramble + "' Has Been Randomly Scrambled To: " + stringScrambled
else:
    print "The Scrambler Can Only Scramble One Word At A Time!"
            
Comments
Sorry but there are no comments to display