Answer:import random
class Word(object):
def __init__(self):
self.word = ""
def set_word(self, word):
self.word = word
def lowercase(self):
self.word = self.word.lower()
def scramble(self):
length = len(self.word)
perm = 1
for x in range(1, length+1):
perm *= x
scrambled = list()
for i in range(0, perm):
woo = [x for x in self.word]
random.shuffle(woo)
scrambled.append("".join(woo))
scrambled = sorted(scrambled)
print(scrambled)
print(f"Number of permutations: {len(scrambled)}")
d = Word()
d.set_word("under")
print(d.lowercase())
print(d.scramble())
Step-by-step explanation:
The python program defines a class called "Word" that uses an accessor "set_word" to pass in a string value to the object variable "self.word". The lowercase() method converts the string to lowercase if it is capitalized and the scramble() method returns a list of possible rotations of the letters of the word.