For this option, you will first ask "how many rows?", and get a positive integer from them. Next, you will ask
"how many columns?", and get another positive integer from them. The next step is to ask for an alignment of
each column. They will enter "L", "C", or "R" for each column. You will then accept rows x columns entries
(don't require them to be any particular type). Finally, print out the items into a table such that:
• each column's items aligned as requested – left, center, or right. Fill blanks with the space character.
• a single space, followed by a tab, is the exact distance between a column's longest element and the next
column. Items in a column that are not longest will need extra spacing to achieve identical spacing
between themselves and the next column.
• Right-aligned columns will be just long enough for the longest item, and then all items' last characters will
then have the space and tab after them.
• The last column should have no extra spacing beyond the longest item – each column should thus be the
exact same width, exactly up to the last character requested by the user (e.g., if they left- or center-align,
then the longest item; if they right-align, then all items' last characters).

Recommended Answers

All 2 Replies

    1- format table
    2- word wrap
    3- receipt maker
user= int (input("Enter a  number to indicate your choice:"))

if user==1:
int(input("Enter number of rows:"))
int(input("Enter number of columns:"))

row=0
column=0

for item in column: 
    column+=1
for item in row:
    row+=1

    R- Right alignment
    L- Left aligment
    C- Center alignment

    I am trying to add the rows and columns input by user and ask them for the aignment in format "rows 1 column 1" and so forth but I really don't know how to do so...Is my code right? PLEASE HELP 
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.