+ 2
how to print the given pattern?
_ _ _ x_ _ _x _ _ x x_ _ _x x _ x x x_ _ _x x x and so on and the program should perform thus function as per the number of rows given as input by the user plz answer
1 Odpowiedź
+ 3
Hey, this seems to work nicely for me. The "y" variable isn't necessary I think but I added it for clarity.
n = int(input())
z = 1
y = n
for i in range(n):
print("_"*y + "x"*z + "___" + "x"*z)
y = y-1
z = z+1