Different star patterns codes
Answers
Answered by
5
NOTE: I will be taking the number as 3 for all the star patterns. I know a few star patterns and I am going to drop the code below. If you have any further star patterns in mind, please post an other question and I will answer it as soon as possible :)
___________________________________________
1st pattern:
CODE:
for i in range(1,4):
print( ' * ' * i )
___________________________________________
2nd pattern:
CODE:
for i in reversed(range(1,4)):
print( ' * ' * i )
___________________________________________
3rd pattern:
#Unable to use latex to get this pattern
CODE:
for x,y in zip(range(1,4),reversed(range(3))):
print(' '*y + '*'*x)
___________________________________________
These are the most common star patterns
Similar questions