Editorial for Andyman's Golf Course - Hole 2 - Picture Perfect
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
As a hint, the problem statement says there is an interesting way to do this, which indicates that there exists something special in Python that handles this very case.
This problem was simply designed to showcase Python's f-strings and its features, which includes alignments.
The following example should give an idea on how to do this problem (a center alignment):
a = 'text'
print(f'{a:x^10}')
which outputs
xxxtextxxx
Comments