Unscramble a random word. Re-shuffles if shuffle matches original.
# Word Scramble - NumWorks # Created by Alvar Laigna - https://alvarlaigna.com from random import choice,randint W = ["PYTHON","NUMWORKS","CALCULATOR", "GRAPHING","SNAKE","HANGMAN", "SCRAMBLE","MEMORY","TICTAC","BLENDER"] def shuf(a): for i in range(len(a)-1,0,-1): j=randint(0,i) a[i],a[j]=a[j],a[i] def scramble(): print("\n"*20+"WORD SCRAMBLE\n") word = choice(W) s = list(word) shuf(s) if "".join(s)==word: shuf(s) print("Unscramble:","".join(s)) g = input("Your guess: ").upper().strip() if g==word: print("Correct!") else: print("Nope! Was:",word) if input("Again? y/n: ").lower()=="y": scramble() scramble()