0

I want to string a question in triangle of stars

Print ("* ** *** **** ")

30th Aug 2021, 2:58 PM
Rishanthan Nathan
3 Réponses
+ 2
for x in range(15): print(' '*(15-x)+'*'*x+'*'*x+'*') https://code.sololearn.com/cuiP99YX3cKW/?ref=app
30th Aug 2021, 3:17 PM
SAN
SAN - avatar
+ 2
Hi Rishanthan! Here, you can just print each separated stars in newline. That's also a kind of triangle shape. For that, you can use "\n" character between the strings. We believe this is clearly taught in strings lesson of python for beginners course.
30th Aug 2021, 3:32 PM
Python Learner
Python Learner - avatar
0
for x in range(i := int(input())): print (' '*(i-x)+'**'*x+'*')
30th Aug 2021, 5:43 PM
Maisu
Maisu - avatar