Ask coding questions

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

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 (4427)

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 (7)

@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 (721)

@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 (7)

@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.?