Answers for "How to justify a string in Python f-strings"

1

How to justify a string in Python f-strings

s1 = 'Python'
s2 = 'ython'
s3 = 'thon'
s4 = 'hon'
s5 = 'on'
s6 = 'n'

print(f'{s1:>6}')
print(f'{s2:>6}')
print(f'{s3:>6}')
print(f'{s4:>6}')
print(f'{s5:>6}')
print(f'{s6:>6}')
...
Python
 ython
  thon
   hon
    on
     n

....
Posted by: Guest on August-30-2021

Code answers related to "How to justify a string in Python f-strings"

Python Answers by Framework

Browse Popular Code Answers by Language