'I am trying to run j loop for n-i time but in for loop on trying same i am getting invalid syntax error
I wanted to print * pattern, so I was trying to run the j loop that is representing column has to run (n-i) times to print that many stars on ith row.
def pattern2(n):
for i in range(0,n):
for j in range(0, (n-i)):
print("*", end=" ")
print("\r")
n=int(input("enter no of rows: "))
pattern2(n)
SyntaxError: invalid syntax (<string>, line 3)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
