I want to print the below pattern
*
* *
* * *
* * * *
* * * * *
I have a below logic which prints the desired output as expected in above
Is it a right approach to print the pattern. Any other approach / unique trick to get the output
for row in range(1,6):
for col in range(1,6):
if row is col:
print(row * '* ')
>Solution :
You don’t need the second for loop, just print your line directly:
for row in range(1,6):
print(row * '* ')