lundi 17 janvier 2022

I need help to print this pattern in python, i have given my approach but couldnt figure out pls support

Required Pattern

My Approach Code:

n=int(input(":"))
for i in range(n+1):
    for j in range(1,i+1):
        print(","+str(j), end="")
    print()
    
for i in range(n, 1, -1):
    for j in range(1, i):
        print(","+str(j), end="")
    print()

But Couldnt get required pattern pls help

Aucun commentaire:

Enregistrer un commentaire