1👍
As you’re appending everything to a list then you can use zip()
and some string formatting to get the desired result:
items=['Books','Sciences','Comics']
stock_qua=[990,825,930]
sold_qua=[45,75,60]
total_sto=[1035,1035,990]
total_amt=[14576,15666,12666]
profit=[1777,1555,1777]
print "{0:12s}{1:12s}{2:12s}{3:15s}{4:15s}{5:12s}".format("Item Name", "stock qty","sold qty","total stock","total amount","profit")
for item,stock,sold,tot_st,amt,pro in zip(items,stock_qua,sold_qua,total_sto,total_amt,profit):
print "{0:12s}{1:^10d}{2:^10d}{3:^15d}{4:^15d}{5:^12d}".format(item,stock,sold,tot_st,amt,pro)
output:
Item Name stock qty sold qty total stock total amount profit
Books 990 45 1035 14576 1777
Sciences 825 75 1035 15666 1555
Comics 930 60 990 12666 1777
Source:stackexchange.com