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 ответов
+ 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)