Question: Write a Python program that prints a square of size depending on an entered value. The program first reads the size of the square and

Write a Python program that prints a square of size depending on an entered
value. The program first reads the size of the square and then prints the square
with a pattern according to the examples below. The figure shows two
different executions of the program.
You should use a pair of nested for-loop for printing the pattern and the
program should validate the input to make sure that it is an integer and is larger
than 0, prompt an error message for invalid input
Enter size of pattern: 6
******
*****6
****67
***678
**6789
*67890
Enter size of pattern: 11
***********
**********1
*********12
********123
*******1234
******12345
*****123456
****1234567
***12345678
**123456789
*1234567890
Enter size of pattern: a
Size of pattern must be an integer, try again
Enter size of pattern: -1
Size of pattern can't be less than or equal to 0, try again
Enter size of pattern:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!