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))
    award=[]
    if x==win:
        reward='1,000,000'
        message='Three matching in exact order'
    elif x[0]and x[1]and x[2] in win==True:
        reward='1,000'
        message='Three matching, not in order' 	
    elif len(set1)==2:
        reward='100'
        message='Two matching' 	
    elif len(set1)==1:
        reward='10'
        message='Any one matching'
    elif len(set1)==0:
        reward='0'
        message='No matches'
    award.append(reward)
    header='{:>0}{:>20}{:>12}{:>17}'.format('User Entry','Numbers Generated','Message','Award')
    results='{:>0}{:>13}{:>33}{:>8}'.format(frmtGuess,frmtWin,message,reward)
    print(header)
    print(results)


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:
    labMenu()
    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: '))
        win=[]
        for x in range (0, 3):
            win.append(random.randrange(0, 9))
        userGuess=[]
        userGuess.append(guess1)
        userGuess.append(guess2)
        userGuess.append(guess3)
        frmtGuess=str(userGuess)[1:-1]
        frmtWin=str(win)[1:-1]
        lottery(userGuess)
  
    elif choice == 2:
        #rps code

    elif choice == 3:
        done = True
    

Open in new window

L WardAsked:
Who is Participating?
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.

gelonidaCommented:
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
1

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
Python

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.