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)

4th Aug 2017, 4:19 AM
Manish Pal
Manish Pal - avatar
2 Respostas
+ 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)
4th Aug 2017, 6:34 AM
visph
visph - avatar
+ 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)
4th Aug 2017, 4:43 AM
lion
lion - avatar