i am creating a "Stock portfolio" for my school project. The portfolio should show the No,Company name, Cap,Qty,boughtprice and marketprice. I was able to create the 2D list and print it out, however the output is not align. Below is my code:
listofstock=[]
listofstock.append(["No","Company","Cap","Qty","BoughtPrice","MarketPrice"])
listofstock.append([1,"Microsoft","Mega",100,188,207])
listofstock.append([2,"Amazon","Mega",5,1700,3003])
listofstock.append([3,"PayPal","Large",80,100,188])
listofstock.append([4,"Apple","Large",100,60,110])
listofstock.append([5,"Fastly","Mid",30,40,76])
listofstock.append([6,"Square","Mid",30,40,178])
for row in listofstock:
for col in row:
print(col," ",end=" ")
print()
The output is not aligned with my headers at all, how do I make it align?