commited all contents created by participants

This commit is contained in:
Bachir Soussi Chiadmi
2017-12-21 18:12:40 +01:00
parent cefd1c2ad0
commit b936b1e616
2137 changed files with 1076319 additions and 730 deletions
@@ -0,0 +1,25 @@
#!/usr/bin/python
# this is a shebang: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
'''
This script takes a sentence you write in the terminal, and gives it back in alphabetical order
A list is ordered and changeable. It is less efficient than a set/tuple. But it allows to work with index numbers.
Check out other options for list comprehension: https://docs.python.org/3/tutorial/datastructures.html
Made for OLA #5, Paris, 15-17 décembre 2017
'''
# Ask to write a sentence
sentence = "Les gouvernements suspectent la littérature parce quelle est une force qui leur échappe"
# print sentence
print("phrase originale:", sentence)
# Split sentence into words
words = sentence.lower().split()
print(words)
# sort words of list
words.sort()
print(words)
# print sorted wordlist as string
print("phrase alphabétique:", " ".join(words).capitalize()+ '.')