mercredi 24 février 2021

How to get asterisk pattern one after another?

I want to print two patterns in the same program but one in front of the other like this:

enter image description here

I have written the rest of the code but my pattern is indented normally:

x = input("Please enter any number: ")

for i in range(0,5):
    for j in range(0,5):
        print('*', end="")
    print()

print("\n")
for i in range(0,5):
    for j in range(0,5):
        if (i==0 or i==5-1 or j==0 or j==5-1):
            print('*', end='')
        else:
            print(' ', end= '')
    print()

My output: enter image description here

Any help would be appreciated!

Aucun commentaire:

Enregistrer un commentaire