phrase_sans_espaces2~20171216-175417.py 421 B

12345678910111213141516171819202122
  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))