Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

finish recursive python3 program? the program uses a recursive function to scramble a string and print out all of the possibilities. The question marks indicates

finish recursive python3 program? image text in transcribed

the program uses a recursive function to scramble a string and print out all of the possibilities. The question marks indicates places where the code needs to be finished. Comments should help with what needs to be there. Sample output is shown. image text in transcribed

def scramble(currentScramble, lettersLeft): # base case if ??? # prints out print(???) variable to see result # recursive case else: # for each letter available for scramble for i in range(len lettersLeft)): letter lettersLeftli] # creates a copy of the string without that letter while 1 TenC1ettersLeft): newlettersLeft lettersLeftil + lettersLefti+1:7 # set past the end of string to exit loop = len(letterseft) # add letter removed from lettersLeft to current scrambled word newScramble-2?? # recursive call def mainQ: print("Welcome to scrambler!") word inputC" Please enter a string to scramble:") # call recursive function. scramble() takes in currentScramble, lettersLeft print("Thank you for using the scrambler!n") main) def scramble(currentScramble, lettersLeft): # base case if ??? # prints out print(???) variable to see result # recursive case else: # for each letter available for scramble for i in range(len lettersLeft)): letter lettersLeftli] # creates a copy of the string without that letter while 1 TenC1ettersLeft): newlettersLeft lettersLeftil + lettersLefti+1:7 # set past the end of string to exit loop = len(letterseft) # add letter removed from lettersLeft to current scrambled word newScramble-2?? # recursive call def mainQ: print("Welcome to scrambler!") word inputC" Please enter a string to scramble:") # call recursive function. scramble() takes in currentScramble, lettersLeft print("Thank you for using the scrambler!n") main)

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

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago