Advertisement
ToxaLay

Таблица

Jun 28th, 2022
1,001
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name =   " морозов владимир алексеевич   "
  2. age =    43
  3. gender = "мужскоЙ "
  4. table_col_widht = 11
  5. table_name  = " Тестовая таблица номер 1"
  6.  
  7. name = name.strip().title()
  8. gender = gender.strip().lower()
  9. table_name = table_name.strip().capitalize()
  10. # f = name[:7]
  11. # i = name[8:16]
  12. # o = name[-10:]
  13. f, i, o = name.split(" ")[:3]
  14.  
  15. print(table_name.center(table_col_widht*3+2))
  16.  
  17. s1 = "Фамилия".ljust(table_col_widht)
  18. s2 = f.center(table_col_widht)
  19. s3 = str(len(f)) + " cимволов"
  20. s3 = s3.rjust(table_col_widht)
  21. print(s1 + ":" + s2 + ":" + s3)
  22.  
  23. s1 = "Имя".ljust(table_col_widht)
  24. s2 = i.center(table_col_widht)
  25. s3 = str(len(i)) + " cимволов"
  26. s3 = s3.rjust(table_col_widht)
  27. print(s1 + ":" + s2 + ":" + s3)
  28.  
  29. s1 = "Отчество".ljust(table_col_widht)
  30. s2 = o.center(table_col_widht)
  31. s3 = str(len(o)) + " cимволов"
  32. s3 = s3.rjust(table_col_widht)
  33. print(s1 + ":" + s2 + ":" + s3)
  34.  
  35. s1 = "Возраст".ljust(table_col_widht)
  36. s2 = str(age).center(table_col_widht)
  37. print(s1 + ":" + s2 + ":")
  38.  
  39. s1 = "Пол".ljust(table_col_widht)
  40. s2 = gender.center(table_col_widht)
  41. print(s1 + ":" + s2 + ":")
  42.  
Advertisement
RAW Paste Data Copied
Advertisement