Question: Python - please change the for loops in this program into while loops 1 import random 3 def scramble (word): result word[0] # first one
Python - please change the for loops in this program into while loops
1 import random 3 def scramble (word): result word[0] # first one same 6 if len(word) 2: for i in range(1, len(word)-1): 1.append(i) random. shuffle(1) # shuffling the middle indices 10 for index in 1: 12 13 14 result +-word [index] # changing the letters result +- word[len(word)-1] # last one same 16 17 return result 18 19 text-input("Enter a 20 print("Scrambled word word: ") is", scramble(text))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
