HackerRank Text Alignment | String Formatting
In this question already provided the code which print hackerrank logo as output we just need to put alignment func to placeholder ------- and its done
its use string function alignment and padding stuff
ljust ; left just
rjust ; right just
center : center
On First look the code look complicated and you do not figure out but its easy ,if you ever before tried those star patterns based question on your college you can solve it with ease
Do not look the whole code and Do not try to print or solve whole logo patterns
Try each code block or for loops and try to print each part of logo one by one
First Top Cone ,Top Pillars Left and right and belt here just using center and then again bottom pillars
with left and right
if your figure out this means your have solved half of problem and you can print half logo
the main issue was bottom cone that present in right-side this part is little tricky where we have to carefully look it
![]() |
| Top Cone |
![]() |
| Top Cone and Both Top Pillars |
![]() |
| Top Cone ,Left and Right Top Pillars and Middle Belt |
![]() |
| Top Cone, Top Pillars, Belt , Bottom Pillars |
Problem: https://www.hackerrank.com/challenges/text-alignment/problem
code:
Output:
If you find this solution effective please leave us comments , your comment will motivate use to more informative blogs for future





