formatting string output

Hello, I am trying to get the formatting for my output (results) to match up with the header. I cant seem to get it to align irregardless of the values under the header.  Does anyone have a trick for this? Thanks in advance!
Desired output:
User Entry      Numbers Generated      Message                  Award
1, 2, 3            5,1, 3                          Two Matching      $100

import random
def lottery(x):
    set1=list(set(x)& set(win))
    if x==win:
        message='Three matching in exact order'
    elif x[0]and x[1]and x[2] in win==True:
        message='Three matching, not in order' 	
    elif len(set1)==2:
        message='Two matching' 	
    elif len(set1)==1:
        message='Any one matching'
    elif len(set1)==0:
        message='No matches'
    header='{:>0}{:>20}{:>12}{:>17}'.format('User Entry','Numbers Generated','Message','Award')

def labMenu():
    print('Enter 1 for Lottery')
    print('Enter 2 for Rock, Paper, Scissors')
    print('Enter 3 to exit the program')

done = False

while not done:
    choice = int(input('Please make an entry: '))

    if choice == 1:
        print('Guess three numbers between 0 and 9')
        guess1 = int(input('Enter first guess: '))
        guess2 = int(input('Enter second guess: '))
        guess3 = int(input('Enter third guess: '))
        for x in range (0, 3):
            win.append(random.randrange(0, 9))
    elif choice == 2:
        #rps code

    elif choice == 3:
        done = True

Open in new window

L WardAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If you want to align two formatted rows you have to specify a width for each column and the widths for the title column formatter and the data column formatters should be identical.

The format string for headers is '{:>0}{:>20}{:>12}{:>17}'   . Here the first columns does not have a width specified.
The format string for your data (results)  is {:>0}{:>13}{:>33}{:>8}. Here the first column also doesn't have a width specified and the other column widths do not match the width of the header formatter.

You can try to use the same formatter for both (which must specify a width for each (even for the first) column.

You could try for example:
 '{:>13}{:>20}{:>12}{:>17}'  for both

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.