How to print "* ** *** ** *" in line by line? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How to print "* ** *** ** *" in line by line?

first * and than second line ** than third line *** after that decrease tha star ** and last one * ...

20th Mar 2018, 6:32 AM
Nizamuddin Ansari
Nizamuddin Ansari - avatar
5 Answers
+ 18
can be done by joining 2 pattens also ... first make upper triangle & then lower triangle , then place lower triangle below //thats the basic way/logic to make these patterns
20th Mar 2018, 10:16 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 10
for i in range(1, 6): print(i * "*" if i < 3 else (6 - i) * "*")
20th Mar 2018, 7:10 AM
David Ashton
David Ashton - avatar
+ 5
So, you basically want this pattern? * ** *** ** * In what language?
20th Mar 2018, 6:37 AM
ChaoticDawg
ChaoticDawg - avatar
0
PHP , C ,C++ whatever... I need some logic only
20th Mar 2018, 6:38 AM
Nizamuddin Ansari
Nizamuddin Ansari - avatar
- 1
print("*\n**\n***\n**\n*")
20th Mar 2018, 10:33 PM
Moeed