Q:

Write a Python program to scramble the letters of string in a given list

0

Write a Python program to scramble the letters of string in a given list.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

from random import shuffle

def shuffle_word(text_list):
    text_list = list(text_list)
    shuffle(text_list)
    return ''.join(text_list)

text_list = ['Python', 'list', 'exercises', 'practice', 'solution'] 
print("Original list:")
print(text_list)
print("\nAfter scrambling the letters of the strings of the said list:")
result =  [shuffle_word(word) for word in text_list]
print(result)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now