0
Pls correct it
def pattern(n):Â num = 1Â for i in range(0, n):Â num = 1Â for j in range(0, i+1):Â print(num, end=" ")Â num = num + 1Â print("\r") n = 5 pattern(n)
2 Answers
+ 4
# Or maybe:
def pattern(n):
for i in range(0, n):
num = 1
for j in range(0, i+1):
print(num, end=' ')
num = num + 1
print()
pattern(5)
# without indentation, Python interpreter cannot understand your code: even for a human, there's quickly too much implicite ^^ (all the more if the expected pattern to be printed isn't specified :P)
+ 2
def pattern(n):
num = 1
for i in range(0, n):
for j in range(0, i+1):
print(num, end=' ')
num = num + 1
print("\r")
pattern(5)