Question: Python Problem Task 1: Using Nested for-loops to Shrink Words For this task you'll use nested for-loops to print the same string a number of
Python Problem

Task 1: Using Nested for-loops to Shrink Words For this task you'll use nested for-loops to print the same string a number of times, each time decreasing the spacing between the characters in the string until there are no spaces the final time the string is printed. You'll also have to convert the string to a list to access each character. Use the list ) function to do this. You'll need two functions for this program: shrink): Takes two arguments and returns nothing. The first argument is the string and the second argument is the number of lines of output-i.e., the number of times the string is printed. Uses nested for-loops to print the string. If nlines is the number of lines of output, the first line of output should have nlines-1 spaces between each character. The second line of output should have nlines - 2 spaces between each character. This continues until the last line of output has nlines - nlines spaces between each char- acter. The outer for-loop should produce the number of spaces, and the inner loop should loop through all the characters, printing each character and the spaces that follow it. main): Prompts user for the string to shrink and the number of lines as shown in the listings below. Calls shrink. The listings below show the correct behavior of this program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
