Python Forum

Full Version: Table creating code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi all,
below is the code posted by me. I am getting the error of undefined token for the tabulate code while printing it in visual studio.
Kindly help with the modification.

from tabulate import tabulate

people_array = list()
people = input("How many people ordered?  ")
print("Enter people and their orders in list:")

a=[]
b=[]
c=[]


for i in range(int(people)):
    p = str(input("Person :"))
    o1 = str(input("Apple Cider ordered by",p," :"))
    o2 = str(input("Apple juice orderd by",p, " :"))

    a.append(p)
    b.append(o1)
    c.append(o2)

print tabulate(a,b,c,headers=["Name","AC","AJ"])


    #print(a ,"\n", b ,"\n", c ,"\n")
#print(q,w)
You must use a list of lists as the first parameter:
print(tabulate([a,b,c],headers=["Name","AC","AJ"])