how can I format dynamically | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

how can I format dynamically

See program: 3d should be variable... maybe length of input https://code.sololearn.com/c3xNy3y3Kqfj/?ref=app

8th Jul 2020, 11:41 AM
Oma Falk
Oma Falk - avatar
7 Answers
+ 7
It looks like we can use pandas dataframe to output table-like data. See the sample in the file: https://code.sololearn.com/c790Hm8uoR7k/?ref=app
8th Jul 2020, 5:46 PM
Lothar
Lothar - avatar
+ 5
Oma Falk, can you please make us a sample for output to clearly understand your needs? Do you want to output in columns? May be you check the max width of a column and use this value to format output with f-strings? Thanks!
8th Jul 2020, 2:29 PM
Lothar
Lothar - avatar
+ 4
Here is an other try to print table-like formatted data: https://code.sololearn.com/c415KS1R03ir/?ref=app
8th Jul 2020, 7:43 PM
Lothar
Lothar - avatar
+ 2
Lothar recently I read that pandas formats mininum as good as matplotlib.
8th Jul 2020, 5:17 PM
Oma Falk
Oma Falk - avatar
+ 2
Lothar but for that we have to keep all data in memory. print and forget wont work.
8th Jul 2020, 5:59 PM
Oma Falk
Oma Falk - avatar
8th Jul 2020, 12:35 PM
Oma Falk
Oma Falk - avatar
0
Lothar it was originally this https://code.sololearn.com/c5pI6qc6SbHp/?ref=app code. depending on n one number should have place 1-3 digits.
8th Jul 2020, 2:31 PM
Oma Falk
Oma Falk - avatar