Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+5 votes
asked in CSC201 Spring 2021 by (1 point)

3 Answers

+4 votes

I usually use .ljust() or .rjust() to right or left justify something. Put a number in the parentheses for the amount of characters. It takes some trial and error.

answered by (1 point)

This is okay, but we learned about f-strings in class and they are more convenient once you get comfortable with them.

+4 votes

Use f-strings with width field specifiers, like:

print (f"{lastName:14} {firstName:12} ...")
answered by (508 points)
+4 votes

you can also use > number or < number after colon to indicate the space from the left and from the right,
Hope that helps

answered by (1 point)