KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got a function which creates a little star table based on some data collected elsewhere in the program. While the table produces the correct output, since the number of characters in each number changes, it un-aligns the table. For example, 70-78: ***** 79-87: *** 88-96: **** 97-105: ** 106-114: ****** 115-123: **** Is there any way to align the stars so that the output is something like this: 70-78: ***** 79-87: *** 88-96: **** 97-105: ** 106-114: ****** 115-123: **** Here's how I currently print the table. for x in range(numClasses): print('{0}-{1}: {2}'.format(lower[x],upper[x],"*"*num[x]))
Tags (comma-separated)
Save Edits
Cancel