Skip to content

Commit

Permalink
Update Table.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BiresashisDas authored May 31, 2022
1 parent e7b0343 commit 8d7d9b2
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions Turtle/Table.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
# Author :- Biresashis Das


# Here we will see how to create a Table using prettytable module

from prettytable import PrettyTable
table = PrettyTable()
table.add_column("CAR BRAND", ["TATA", "TESLA", "JAGUAR",])
table.add_column("OWNER NAME", ["SIR RATAN TATA", "ELON MUSK", "SIR RATAN TATA",])
table.add_column("CAR BRAND", ["TATA", "MAHINDRA XUV700", "JAGUAR",])
table.add_column("OWNER NAME", ["SIR RATAN TATA", "Mr. ANAND MAHINDRA", "SIR RATAN TATA",])
table.align = "l"
print(table)


# It will show the given output

# +-----------+----------------+
# | CAR BRAND | OWNER NAME |
# +-----------+----------------+
# | TATA | SIR RATAN TATA |
# | TESLA | ELON MUSK |
# | JAGUAR | SIR RATAN TATA |
# +-----------+----------------+

# +-----------------+--------------------+
# | CAR BRAND | OWNER NAME |
# +-----------------+--------------------+
# | TATA | SIR RATAN TATA |
# | MAHINDRA XUV700 | Mr. ANAND MAHINDRA |
# | JAGUAR | SIR RATAN TATA |
# +-----------------+--------------------+

0 comments on commit 8d7d9b2

Please sign in to comment.