tabellen_modul.py 473 B

1234567891011121314151617181920212223242526272829
  1. # Import the tabulate module
  2. from tabulate import tabulate
  3. name = input("Name")
  4. profession= input("Job")
  5. # Sample data: list of lists
  6. data = [
  7. [name, profession],
  8. ["Alice", "Engineer"],
  9. ["Bob","Data Scientist"],
  10. ["Charlie", "Teacher"]
  11. ]
  12. data.append([name, profession])
  13. # Creating a table with headers and a grid format
  14. table = tabulate(
  15. data,
  16. headers=["Name", "Profession"],
  17. tablefmt="grid"
  18. )
  19. print(table)