Python Programming - Console Input/Output - Discussion

Discussion Forum : Console Input/Output - General Questions (Q.No. 47)
47.
How can you align text to the center in a Python console output?
align_center("text")
print("text", align="center")
print(f"{text:^10}")
center_align("text")
Answer: Option
Explanation:
Using the f-string format {text:^10} aligns the text to the center within a 10-character wide space.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.