diegomrodrigues

Truques no Python - Imprimindo uma lista de forma elegante

Mar 16th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.03 KB | None | 0 0
  1. '''
  2. Truques no Python - Imprimindo uma lista de forma elegante
  3.  
  4. Artigo no LinkedIn:
  5. https://www.linkedin.com/pulse/truques-python-imprimindo-uma-lista-de-forma-diego-mendes-rodrigues/
  6.  
  7. Curso de Python 3:
  8. https://produto.mercadolivre.com.br/MLB-991504015-curso-de-python-3-_JM
  9.  
  10. Diego Mendes Rodrigues
  11. '''
  12.  
  13. # Mulheres brasileiras que fizeram história
  14. # https://mdemulher.abril.com.br/estilo-de-vida/20-mulheres-brasileiras-que-fizeram-historia/
  15. mulheres_que_fizeram_historia = ['Dandara', 'Tarsila do Amaral', 'Marta', 'Maria Quitéria']
  16.  
  17. # Realizando o JOIN, colocando uma virgula e um espaço entre cada nome de mulher
  18. mulheres_virgula = ', '.join(mulheres_que_fizeram_historia)
  19. print('Mulheres brasileiras que fizeram história: {}.'. format(mulheres_virgula))
  20.  
  21. # Pulando uma linha
  22. print('')
  23.  
  24. # Realizando o JOIN, colocando uma quebra de linha entre cada nome de mulher
  25. mulheres_varias_linhas = '\n'.join(mulheres_que_fizeram_historia)
  26. print('Mulheres brasileiras que fizeram história: {}.'. format(mulheres_varias_linhas))
Advertisement
Add Comment
Please, Sign In to add comment