I had to make a program where I asked for user input about a Quidditch match and after calculating certain values print out the statistics of the game in an organized manner similar to a table, but was told I wasn't allowed to actually use a table to format it since we haven't reached that point in the book, which I thought was kind of ridiculous.

It is supposed to look like the image in the attached file Donkey and It is easily possible to make it organized with the names Griffindor and Hufflepuff because they have the same number of characters so it just takes trial and error for proper spacing. The problem is I can't get it to look organized if the team names are of a different length, which is what I am curious about.

As for the assignment, I've already been told its good enough and have turned it in since its due at the end of the period, but I really wanted to know if there was a more efficient way that could work with varying string lengths.

If you want to see all of the source code it is in the quidditch_statistcs.txt file and isn't very long. The part referencing about is the last bit after the last comment. I'm also using Python ver 3.3.2 in case anyone needed to know that.

What you need is ljust and rjust. They add extra padding spaces depending on the string length. Say I have the string 'Hello world!'. I want to make the string 15 characters long. I just use `'Hello world!'.ljust(15)` to get 'Hello, world! '. The padding is useful for formatting tables.

print("\tWelcome to CSE 1284 Quidditch Statistics Calculator")print("\nEnter the teams, scores, and time to make it work. It\'s like magic!")

#Prompts user for team names, scores, and the time and displays them.

team1 = input("\nEnter the name of the team that caught the golden snitch: ")print("What was ", team1, "'s final score", end="")score1 = int(input("? "))team2 = input("Enter the name of the other team: ")print("What was ", team2, "'s final score", end="")score2 = int(input("? "))time = int(input("Enter the length of the game in minutes: "))

#Calculates the goals, goals per minute, total and overall average goals per#minute.

Enter the name of the team that caught the golden snitch: helloWhat was hello 's final score? 12Enter the name of the other team: worldxWhat was worldx 's final score? 13Enter the length of the game in minutes: 60