for our python class we are required to have the formatting be perfect to the example given. The example looks like this:
Average Gallons Cost Per
Speed Used Gallon
65.62 72.41 2.07
My output looks like this:
Average Gallons Cost Per
Speed Used Gallon
65.62 72.41 2.07
I need to know how to be able to format my output to look like the one given in the example. Help would be heavily appreciated. Here is my code:
driven = 1050
mpg = 14.5
money = input("How much money was spent: ")
hours = input("Hours driven: ")
average = driven / hours
num = driven / mpg
cpg = money / num
print("{:<14}{:<14}{:<14}".format("Average", "Gallons", "Cost Per"))
print("{:<14}{:<14}{:<14}".format("Speed", "Used", "Gallon"))
print("{:<14.2f}{:<14.2f} {:<14.2f}".format(average, num, cpg))
Thanks in advance!