@virnuls/

Anagrams

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
from random import randint
word = input("Give me a word: ").lower()
anagram = ""
# while there's anything left of the original word...
while len(word) > 0:
  # choose a random character from the word
  char = randint(0,len(word)-1)
  # add that character to the anagram
  anagram += word[char]
  # remove that letter from the original word
  word = word[:char] + word[char+1:]
print(anagram)