12345678910111213141516171819202122232425262728 |
- #!/usr/bin/python
- # -*- coding: utf-8 -*-
- # Write sentence as string
- sentence = "Je vois La Vie en rose... Tu vois Le Ciel en vert!"
- # Print sentence
- print("phrase originale:", sentence)
- new_letter = []
- words = sentence.split()
- # for each word
- for word in words:
- # iterate over letters of word
- for letter in word:
- new_letter.append(letter)
- #print(new_letter)
- print("phrase sans espaces:", "".join(new_letter))
- #for letter in new_letter:
- # new_letter = letter.sort(" ")
- new_letter.sort()
- #print(new_letter)
- print("suite de lettres", "".join(new_letter))
|