Ask coding questions

← Back to all posts
Help on text alignment/Python
JerryTheMouse (4)

I'm trying to align text so on side of the text is aligned to the left and the other to the right... Please help.

mat1 (3379)

I made a Repl with a text alignment function here:
I tried putting as many comments as possible but hopefully they're not too much ;)

Please upvote my comment if it was helpful or useful in any way

JerryTheMouse (4)

@mat1 Thanks, but when i ran your func, hello world appeared on 3 lines. If it isn too much of a request, can you fix it?

ash15khng (694)

@JerryTheMouse His code has 3 demonstrations of the function at lines 36-38. If you want to use it in your code, copy and paste the function into your code, then use the function text_align instead of print and add the alignment.

JerryTheMouse (4)

@ash15khng I perfectly get that, but still theoretically it will still not align
I know there’s 3 ex., but shouldn’t they be more ore less centred, etc.?