The program starts as how many rows? how many coloumns? Alignment of each coloumn?(Left(L), Centre(C), Right(R)). Then accept entries(data in table) from the user. The entries should be printed in the format specified by the user? Here’s what I have done so far:
rows = input("How many rows?")
coloumns = input("How many coloumns?")
alignment = raw_input("Enter alignment of each table?")
entry = raw_input("Enter rows x cols entries:")
print entry
I think I have to format entry in such a way that it comes out exactly how the user wants. How can I do it? Thanks
This block of code referenced from http://ginstrom.com/scribbles/2007/09/04/pretty-printing-a-table-in-python/ will help you.
In your case, because you are collecting inputs of rows, columns, alignment and entry in the table you can plug them in to construct your
tablevariable.equivalent to your number of rows (-1 to prevent counting in the table header).
dynamically computed using
rjustandljustmethods while calculating a particular column.updated using standard python list syntax.