Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python - please change the for loops in this program into while loops 1 import random 3 def scramble (word): result word[0] # first one

image text in transcribedPython - 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

=+6. What does the invisible hand of the marketplace do?

Answered: 1 week ago

Question

=+ 4. Why should policymakers think about incentives?

Answered: 1 week ago