make a flowchart that shows ALL required input, output, process,…
Question Answered step-by-step make a flowchart that shows ALL required input, output, process,… make a flowchart that shows ALL required input, output, process, selection and looping for this code import randomdef scramble(word): scrambled = ” while len(word) > 0: pos = random.randrange(len(word)) scrambled += word[pos] word = word[:pos] + word[pos+1:] return scrambledprint(“Welcome to the Word Scrambler!”)print(“Please enter a word between 3 and 10 letters.”)while True: word = input(“Enter a word: “) if 3 <= len(word) <= 10: break print("That's not the right number of letters!")print("The original word is", word)print("The scrambled word is", scramble(word)) Explanation about the code:The program starts by importing the random module. This module provides functions for generating random numbers.Next, the program defines a function called scramble. This function takes one parameter, word. The function will return a string that is a scrambled version of the word that is passed in.The function starts by creating an empty string called scrambled. It then enters a while loop. This loop will run as long as the word that was passed in has at least one letter.Inside the while loop, the function generates a random number between 0 and the length of the word. This number is used to select a letter from the word. The letter is added to the end of the scrambled string. The word that was passed in is then updated so that the letter that was just added to the scrambled string is removed.Once the while loop has finished, the scrambled string is returned.After the function is defined, the program prints a welcome message and instructions to the user. It then enters a while loop. This loop will run until the user enters a word with the correct number of letters.Inside the while loop, the program prompts the user to enter a word. If the word has 3 to 10 letters, the program breaks out of the loop. Otherwise, the user is prompted to enter a word again.After the while loop has finished, the program prints the original word and the scrambled word. Computer Science Engineering & Technology Python Programming Share QuestionEmailCopy link Comments (0)


