suite_de_lettres_phrase~20171216-175401.py 565 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. # Write sentence as string
  4. sentence = "Je vois La Vie en rose... Tu vois Le Ciel en vert!"
  5. # Print sentence
  6. print("phrase originale:", sentence)
  7. new_letter = []
  8. words = sentence.split()
  9. # for each word
  10. for word in words:
  11. # iterate over letters of word
  12. for letter in word:
  13. new_letter.append(letter)
  14. #print(new_letter)
  15. print("phrase sans espaces:", "".join(new_letter))
  16. #for letter in new_letter:
  17. # new_letter = letter.sort(" ")
  18. new_letter.sort()
  19. #print(new_letter)
  20. print("suite de lettres", "".join(new_letter))