Python Program to Print a Solid Square Pattern

 

Solid Square Pattern using While loop

Write a program to print a solid square pattern of N rows and N columns using the asterisk character (*), where integer N is given as an input.

Input

The first line input will contain a positive integer.

Output

The output should be the N number of lines and N number of columns with the asterisk character (*).

Note: There is a space after each asterisk character(*).

Explanation

For example, if the given number is 4, your code should print the following pattern:

* * * * 
* * * * 
* * * * 
* * * * 

For example, if the given number is 2, your code should print the following pattern:

* * 
* * 

Sample Input 1
6

Sample Output 1

* * * * * 
* * * * * 
* * * * * 
* * * * * 
* * * * *

Code

n=int(input())
counter=0
while counter<n:
    print("* "*n)
    counter=counter+1

Input
3

Output

* * * 
* * * 
* * * 

Comments

Popular posts from this blog

CODING ASSIGNMENT 4

CODING PRACTICE 11 Music Page

CODING ASSIGNMENT 3