commited all contents created by participants
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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 = "Unless we can begin embody the notion of change is the words we use, we will continue to be lost"
|
||||
# print sentence
|
||||
print("phrase originale:", sentence)
|
||||
|
||||
# Split sentence into words
|
||||
words = sentence.lower().split()
|
||||
print(words)
|
||||
|
||||
# sort words of list
|
||||
words.sort()
|
||||
|
||||
|
||||
# print sorted wordlist as string
|
||||
print("phrase alphabétique:", " ".join(words).capitalize(), '.')
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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 = "Unless we can begin to embody the notion of change in the words we use, we will continue to be lost"
|
||||
# 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(), '.')
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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 = "Unless we can begin to embody the notion of change in the words we use, we will continue to be lost"
|
||||
# print sentence
|
||||
print("phrase originale:", sentence)
|
||||
|
||||
# Split sentence into words
|
||||
words = sentence.lower().split()
|
||||
print(words)
|
||||
|
||||
uniquewords = set(words)
|
||||
print (uniquewords)
|
||||
# sort words of list
|
||||
uniquewords.sort()
|
||||
print(uniquewords)
|
||||
|
||||
# print sorted wordlist as string
|
||||
print("phrase alphabétique:", " ".join(words).capitalize(), '.')
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
# 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 = "Unless we can begin to embody the notion of change in the words we use, we will continue to be lost"
|
||||
# print sentence
|
||||
print("phrase originale:", sentence)
|
||||
|
||||
# Split sentence into words
|
||||
words = sentence.lower().split()
|
||||
print(words)
|
||||
|
||||
uniquewords = set(words)
|
||||
print(uniquewords)
|
||||
# sort words of list
|
||||
#uniquewords.sort()
|
||||
#print(uniquewords)
|
||||
|
||||
# print sorted wordlist as string
|
||||
print("phrase alphabétique:", " ".join(words).capitalize(), '.')
|
||||
@@ -0,0 +1,3 @@
|
||||
phrase originale: Unless we can begin embody the notion of change is the words we use, we will continue to be lost
|
||||
['unless', 'we', 'can', 'begin', 'embody', 'the', 'notion', 'of', 'change', 'is', 'the', 'words', 'we', 'use,', 'we', 'will', 'continue', 'to', 'be', 'lost']
|
||||
phrase alphabétique: Be begin can change continue embody is lost notion of the the to unless use, we we we will words .
|
||||
Reference in New Issue
Block a user