Answers for "print a formatted table using python"

0

print a formatted table using python

import pandas as pd

d = [ ["Mark", 12, 95],
     ["Jay", 11, 88],
     ["Jack", 14, 90]]

df = pd.DataFrame(d, columns = ['Name','Age','Percent'])
print(df)
Posted by: Guest on June-24-2021
0

print a formatted table using python

d = [ ["Mark", 12, 95],
     ["Jay", 11, 88],
     ["Jack", 14, 90]]
     
print ("{:<8} {:<15} {:<10}".format('Name','Age','Percent'))

for v in d:
    name, age, perc = v
    print ("{:<8} {:<15} {:<10}".format( name, age, perc))
Posted by: Guest on June-24-2021

Code answers related to "print a formatted table using python"

Python Answers by Framework

Browse Popular Code Answers by Language