Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


0 votes
asked in CSC201 by (4.2k points)

1 Answer

0 votes

Although using the width in an f-string seems promising, you get a syntax error when you try to use a variable for the width.

One way to get multiple spaces is using string repetition (*). I'm going to use sp to designate a space though you don't do that in your code.

'sp' 1 is one space
2 is two spaces
'sp' * 3 is three spaces

'sp' * num (where num is an integer variable) is num spaces.

answered by (4.2k points)