печально быть антисоциальным - Post a comment

Apr. 21st, 2008

[info]smejmoon

12:59 pm - hello goodbye


>>> 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.

Read Comments

Reply:

From:
( )Anonymous- this user has disabled anonymous posting.
Username:
Password:
Subject:
No HTML allowed in subject
  
Message:

Notice! This user has turned on the option that logs your IP address when posting.