печально быть антисоциальным - hello goodbye

Apr. 21st, 2008

12:59 pm - hello goodbye

Previous Entry Add to Memories Tell A Friend Next Entry


>>> s = set(x.split())
>>> s
set(['and', 'bye,', "don't", 'helloa', 'Why,', 'high,', 'Goodbye,', 'go', 'You', 'Oh,', 'Do', 'Hello,', 'yes,', 'no', 'Hello', 'why,', 'low', 'you', 'bye', 'hello,', 'good', 'I', 'stop', 'know', 'why', 'go,', 'say', 'goodbye', 'heba', 'Hela,', 'hello'])
>>> l = list(s)
>>> l = [el.lower() for el in l]
>>> l
['and', 'bye,', "don't", 'helloa', 'why,', 'high,', 'goodbye,', 'go', 'you', 'oh,', 'do', 'hello,', 'yes,', 'no', 'hello', 'why,', 'low', 'you', 'bye', 'hello,', 'good', 'i', 'stop', 'know', 'why', 'go,', 'say', 'goodbye', 'heba', 'hela,', 'hello']
>>> l = [el.replace(",","") for el in l]
>>> l
['and', 'bye', "don't", 'helloa', 'why', 'high', 'goodbye', 'go', 'you', 'oh', 'do', 'hello', 'yes', 'no', 'hello', 'why', 'low', 'you', 'bye', 'hello', 'good', 'i', 'stop', 'know', 'why', 'go', 'say', 'goodbye', 'heba', 'hela', 'hello']
>>> s = set(l)
>>> s
set(['and', "don't", 'helloa', 'high', 'say', 'hela', 'go', 'yes', 'no', 'why', 'low', 'heba', 'bye', 'do', 'good', 'stop', 'know', 'you', 'oh', 'i', 'goodbye', 'hello'])
>>> l = list(s)
>>> l.sort()
>>> l
['and', 'bye', 'do', "don't", 'go', 'good', 'goodbye', 'heba', 'hela', 'hello', 'helloa', 'high', 'i', 'know', 'low', 'no', 'oh', 'say', 'stop', 'why', 'yes', 'you']
>>> len(l)
22



Hello Goodbye (c) The Beatles 1967.

(Leave a comment)