+ 1

Why isnā€™t my * triangle code acceptable?

It looks to me like Iā€™ve solved the practice q but itā€™s not an acceptable answer, so Iā€™m stuck. Please could someone give me a steer? https://code.sololearn.com/cTZqbc3Xs46x/?ref=app

18th Sep 2021, 4:17 PM
Sarah von Blumenthal
7 Answers
+ 3
You should only remove all the spaces. And i have a newline after the last four stars, i don't know if it will make a difference.
18th Sep 2021, 4:27 PM
Paul
Paul - avatar
+ 1
Paul, thank you - that worked. I had envisioned a different alignment for the triangle. Making it more complicated than it needed to be!
18th Sep 2021, 4:31 PM
Sarah von Blumenthal
0
You should use a loop to print the stars as a shape triangle, I think. Happy coding!
18th Sep 2021, 4:19 PM
mesarthim
mesarthim - avatar
0
Iā€™m only on Lesson 8.1 and havenā€™t been introduced to loops yet, so I wonder if thereā€™s another reason?
18th Sep 2021, 4:22 PM
Sarah von Blumenthal
0
print(" *\n * *\n * * *\n* * * *") Try this!
18th Sep 2021, 4:23 PM
Vadivelan
0
Sarah von Blumenthal I see, no problem. Just try to print all lines one by one. print("*") print("**") ... Happy coding!
18th Sep 2021, 4:25 PM
mesarthim
mesarthim - avatar
0
Thanks Vadivelan. Iā€™m afraid it didnā€™t work. mesarthim Iā€™ll try that, but the activity tip talked about using spaces and \n
18th Sep 2021, 4:27 PM
Sarah von Blumenthal