Using while loop or for loop to write a script p3.py that reads an integer value n and a string str from the user's input and then produces a 2n-1-column block, repeatedly. For the 2n-1-column output, the first column contains 1 str at the bottom, the second column contains 2 strs at the bottom, and so on until the n-th column, which contains exactly n strs. And the remaining n-1 columns will be the reverse of the first n-1 columns. The script will keep asking the user to input an integer value n and a string s and then print the corresponding 2n-1-column block. The script will print the line Program ends. and exit if the user inputs any integer less than 1. For this exercise, you don't need to check whether the user's input is an integer or not also you don't need to consider that a very long input Would rcrou tho format A camplo run chould bo ar follour:
Using while loop or for loop to write a script p3.py that reads an integer value n and a string str from the user's input and then produces a 2n-1-column block, repeatedly. For the 2n-1-column output, the first column contains 1 str at the bottom, the second column contains 2 strs at the bottom, and so on until the n-th column, which contains exactly n strs. And the remaining n-1 columns will be the reverse of the first n-1 columns. The script will keep asking the user to input an integer value n and a string s and then print the corresponding 2n-1-column block. The script will print the line Program ends. and exit if the user inputs any integer less than 1. For this exercise, you don't need to check whether the user's input is an integer or not also you don't need to consider that a very long input Would rcrou tho format A camplo run chould bo ar follour:
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Please do this in python
![Using while loop or for loop to write a script p3.py that reads an integer value n and a
string str from the user's input and then produces a 2n-1-column block, repeatedly. For
the 2n-1-column output, the first column contains 1 str at the bottom, the second column
contains 2 strs at the bottom, and so on until the n-th column, which contains exactly n
strs. And the remaining n-1 columns will be the reverse of the first n-1 columns. The
script will keep asking the user to input an integer value n and a string s and then print the
corresponding 2n-1-column block. The script will print the line Program ends. and exit if
the user inputs any integer less than 1. For this exercise, you don't need to check whether
the user's input is an integer or not also you don't need to consider that a very long input
would screw the format. A sample run should be as follows:
Enter an integer :4
Enter a string:1
1
111
11111
1111111
Enter an integer:2
Enter a string:^_^
Enter an integer:0
Program ends.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6cf466cb-34d2-4f27-81b5-12de9be5b2e8%2Fa0252024-3561-469a-846b-1cd3c9b28662%2Fwveyuut_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Using while loop or for loop to write a script p3.py that reads an integer value n and a
string str from the user's input and then produces a 2n-1-column block, repeatedly. For
the 2n-1-column output, the first column contains 1 str at the bottom, the second column
contains 2 strs at the bottom, and so on until the n-th column, which contains exactly n
strs. And the remaining n-1 columns will be the reverse of the first n-1 columns. The
script will keep asking the user to input an integer value n and a string s and then print the
corresponding 2n-1-column block. The script will print the line Program ends. and exit if
the user inputs any integer less than 1. For this exercise, you don't need to check whether
the user's input is an integer or not also you don't need to consider that a very long input
would screw the format. A sample run should be as follows:
Enter an integer :4
Enter a string:1
1
111
11111
1111111
Enter an integer:2
Enter a string:^_^
Enter an integer:0
Program ends.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education