Python códe for this pattern upto n rows?
*
* *
* * *
* * * *
* * * * *
Write one line códe for this question.
Answers
Answered by
3
Program:
print(*["\n" + "* " * i for i in range(1, int(input("Enter N - ")) + 1)])
Algorithm:
- Accepting the number of rows to be printed.
- Creating the pattern by copying the '*' i times.
- Unpacking the list, therefore printing the pattern in the screen.
Attachments:
anindyaadhikari13:
Awesome.
Answered by
2
Attachments:
Similar questions