2016年6月17日金曜日

開発環境

Think Python (Allen B. Downey (著)、 O'Reilly Media)のChapter 9.(Case Study Word Play)のExercises 9-6(No. 1972)を取り組んでみる。

Exercises 9-6(No. 1972)

コード(Emacs)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

def is_abecedarian(word):
    return ''.join(sorted(word)) == word

if __name__ == '__main__':
    with open('words.txt') as f:
        for line in f:
            for word in line.split():
                if is_abecedarian(word):
                    print('{0}: {1}'.format(word, [ord(ch) for ch in word]))

入出力結果(Terminal, IPython)

$ ./sample6.py
aa: [97, 97]
aah: [97, 97, 104]
aahs: [97, 97, 104, 115]
aal: [97, 97, 108]
aals: [97, 97, 108, 115]
aas: [97, 97, 115]
abbe: [97, 98, 98, 101]
abbes: [97, 98, 98, 101, 115]
abbess: [97, 98, 98, 101, 115, 115]
abbey: [97, 98, 98, 101, 121]
abbot: [97, 98, 98, 111, 116]
abet: [97, 98, 101, 116]
abhor: [97, 98, 104, 111, 114]
abhors: [97, 98, 104, 111, 114, 115]
ably: [97, 98, 108, 121]
abo: [97, 98, 111]
abort: [97, 98, 111, 114, 116]
abos: [97, 98, 111, 115]
abuzz: [97, 98, 117, 122, 122]
aby: [97, 98, 121]
accent: [97, 99, 99, 101, 110, 116]
accept: [97, 99, 99, 101, 112, 116]
access: [97, 99, 99, 101, 115, 115]
accost: [97, 99, 99, 111, 115, 116]
ace: [97, 99, 101]
acers: [97, 99, 101, 114, 115]
aces: [97, 99, 101, 115]
achoo: [97, 99, 104, 111, 111]
achy: [97, 99, 104, 121]
act: [97, 99, 116]
ad: [97, 100]
add: [97, 100, 100]
adder: [97, 100, 100, 101, 114]
adders: [97, 100, 100, 101, 114, 115]
adds: [97, 100, 100, 115]
adeem: [97, 100, 101, 101, 109]
adeems: [97, 100, 101, 101, 109, 115]
adept: [97, 100, 101, 112, 116]
adios: [97, 100, 105, 111, 115]
adit: [97, 100, 105, 116]
ado: [97, 100, 111]
adopt: [97, 100, 111, 112, 116]
ados: [97, 100, 111, 115]
ads: [97, 100, 115]
adz: [97, 100, 122]
ae: [97, 101]
aegis: [97, 101, 103, 105, 115]
aery: [97, 101, 114, 121]
aff: [97, 102, 102]
affix: [97, 102, 102, 105, 120]
afflux: [97, 102, 102, 108, 117, 120]
afoot: [97, 102, 111, 111, 116]
aft: [97, 102, 116]
agin: [97, 103, 105, 110]
agio: [97, 103, 105, 111]
agios: [97, 103, 105, 111, 115]
agist: [97, 103, 105, 115, 116]
aglow: [97, 103, 108, 111, 119]
agly: [97, 103, 108, 121]
ago: [97, 103, 111]
ah: [97, 104]
ahoy: [97, 104, 111, 121]
ai: [97, 105]
ail: [97, 105, 108]
ails: [97, 105, 108, 115]
aim: [97, 105, 109]
aims: [97, 105, 109, 115]
ain: [97, 105, 110]
ains: [97, 105, 110, 115]
air: [97, 105, 114]
airs: [97, 105, 114, 115]
airt: [97, 105, 114, 116]
airy: [97, 105, 114, 121]
ais: [97, 105, 115]
ait: [97, 105, 116]
all: [97, 108, 108]
allot: [97, 108, 108, 111, 116]
allow: [97, 108, 108, 111, 119]
alloy: [97, 108, 108, 111, 121]
alls: [97, 108, 108, 115]
ally: [97, 108, 108, 121]
almost: [97, 108, 109, 111, 115, 116]
alms: [97, 108, 109, 115]
alow: [97, 108, 111, 119]
alp: [97, 108, 112]
alps: [97, 108, 112, 115]
alt: [97, 108, 116]
am: [97, 109]
ammo: [97, 109, 109, 111]
ammos: [97, 109, 109, 111, 115]
amort: [97, 109, 111, 114, 116]
amp: [97, 109, 112]
amps: [97, 109, 112, 115]
amu: [97, 109, 117]
an: [97, 110]
annoy: [97, 110, 110, 111, 121]
ant: [97, 110, 116]
any: [97, 110, 121]
apt: [97, 112, 116]
ar: [97, 114]
ars: [97, 114, 115]
art: [97, 114, 116]
arty: [97, 114, 116, 121]
as: [97, 115]
ass: [97, 115, 115]
at: [97, 116]
aw: [97, 119]
ay: [97, 121]
be: [98, 101]
bee: [98, 101, 101]
beef: [98, 101, 101, 102]
beefily: [98, 101, 101, 102, 105, 108, 121]
beefs: [98, 101, 101, 102, 115]
beefy: [98, 101, 101, 102, 121]
been: [98, 101, 101, 110]
beep: [98, 101, 101, 112]
beeps: [98, 101, 101, 112, 115]
beer: [98, 101, 101, 114]
beers: [98, 101, 101, 114, 115]
beery: [98, 101, 101, 114, 121]
bees: [98, 101, 101, 115]
beet: [98, 101, 101, 116]
befit: [98, 101, 102, 105, 116]
beg: [98, 101, 103]
begin: [98, 101, 103, 105, 110]
begins: [98, 101, 103, 105, 110, 115]
begirt: [98, 101, 103, 105, 114, 116]
begot: [98, 101, 103, 111, 116]
begs: [98, 101, 103, 115]
beknot: [98, 101, 107, 110, 111, 116]
bel: [98, 101, 108]
bell: [98, 101, 108, 108]
bellow: [98, 101, 108, 108, 111, 119]
bells: [98, 101, 108, 108, 115]
belly: [98, 101, 108, 108, 121]
below: [98, 101, 108, 111, 119]
bels: [98, 101, 108, 115]
belt: [98, 101, 108, 116]
ben: [98, 101, 110]
benny: [98, 101, 110, 110, 121]
bens: [98, 101, 110, 115]
bent: [98, 101, 110, 116]
berry: [98, 101, 114, 114, 121]
best: [98, 101, 115, 116]
bet: [98, 101, 116]
bevy: [98, 101, 118, 121]
bey: [98, 101, 121]
bhoot: [98, 104, 111, 111, 116]
bi: [98, 105]
bijou: [98, 105, 106, 111, 117]
bijoux: [98, 105, 106, 111, 117, 120]
bill: [98, 105, 108, 108]
billow: [98, 105, 108, 108, 111, 119]
billowy: [98, 105, 108, 108, 111, 119, 121]
bills: [98, 105, 108, 108, 115]
billy: [98, 105, 108, 108, 121]
bin: [98, 105, 110]
bins: [98, 105, 110, 115]
bint: [98, 105, 110, 116]
bio: [98, 105, 111]
biopsy: [98, 105, 111, 112, 115, 121]
bios: [98, 105, 111, 115]
birr: [98, 105, 114, 114]
birrs: [98, 105, 114, 114, 115]
bis: [98, 105, 115]
bit: [98, 105, 116]
bitt: [98, 105, 116, 116]
bitty: [98, 105, 116, 116, 121]
bloop: [98, 108, 111, 111, 112]
bloops: [98, 108, 111, 111, 112, 115]
blot: [98, 108, 111, 116]
blotty: [98, 108, 111, 116, 116, 121]
blow: [98, 108, 111, 119]
blowy: [98, 108, 111, 119, 121]
bo: [98, 111]
boo: [98, 111, 111]
boor: [98, 111, 111, 114]
boors: [98, 111, 111, 114, 115]
boos: [98, 111, 111, 115]
boost: [98, 111, 111, 115, 116]
boot: [98, 111, 111, 116]
booty: [98, 111, 111, 116, 121]
bop: [98, 111, 112]
bops: [98, 111, 112, 115]
bort: [98, 111, 114, 116]
borty: [98, 111, 114, 116, 121]
bortz: [98, 111, 114, 116, 122]
bos: [98, 111, 115]
boss: [98, 111, 115, 115]
bossy: [98, 111, 115, 115, 121]
bot: [98, 111, 116]
bott: [98, 111, 116, 116]
bow: [98, 111, 119]
box: [98, 111, 120]
boxy: [98, 111, 120, 121]
boy: [98, 111, 121]
buy: [98, 117, 121]
buzz: [98, 117, 122, 122]
by: [98, 121]
cee: [99, 101, 101]
cees: [99, 101, 101, 115]
ceil: [99, 101, 105, 108]
ceils: [99, 101, 105, 108, 115]
cell: [99, 101, 108, 108]
cello: [99, 101, 108, 108, 111]
cellos: [99, 101, 108, 108, 111, 115]
cells: [99, 101, 108, 108, 115]
celt: [99, 101, 108, 116]
cent: [99, 101, 110, 116]
cess: [99, 101, 115, 115]
chi: [99, 104, 105]
chill: [99, 104, 105, 108, 108]
chills: [99, 104, 105, 108, 108, 115]
chilly: [99, 104, 105, 108, 108, 121]
chimp: [99, 104, 105, 109, 112]
chimps: [99, 104, 105, 109, 112, 115]
chin: [99, 104, 105, 110]
chino: [99, 104, 105, 110, 111]
chinos: [99, 104, 105, 110, 111, 115]
chins: [99, 104, 105, 110, 115]
chintz: [99, 104, 105, 110, 116, 122]
chip: [99, 104, 105, 112]
chippy: [99, 104, 105, 112, 112, 121]
chips: [99, 104, 105, 112, 115]
chirr: [99, 104, 105, 114, 114]
chirrs: [99, 104, 105, 114, 114, 115]
chis: [99, 104, 105, 115]
chit: [99, 104, 105, 116]
chitty: [99, 104, 105, 116, 116, 121]
chivvy: [99, 104, 105, 118, 118, 121]
chivy: [99, 104, 105, 118, 121]
choosy: [99, 104, 111, 111, 115, 121]
chop: [99, 104, 111, 112]
choppy: [99, 104, 111, 112, 112, 121]
chops: [99, 104, 111, 112, 115]
chott: [99, 104, 111, 116, 116]
chow: [99, 104, 111, 119]
cist: [99, 105, 115, 116]
city: [99, 105, 116, 121]
civvy: [99, 105, 118, 118, 121]
cloot: [99, 108, 111, 111, 116]
clop: [99, 108, 111, 112]
clops: [99, 108, 111, 112, 115]
clot: [99, 108, 111, 116]
clotty: [99, 108, 111, 116, 116, 121]
cloy: [99, 108, 111, 121]
coo: [99, 111, 111]
coop: [99, 111, 111, 112]
coops: [99, 111, 111, 112, 115]
coopt: [99, 111, 111, 112, 116]
coos: [99, 111, 111, 115]
coot: [99, 111, 111, 116]
cop: [99, 111, 112]
cops: [99, 111, 112, 115]
copy: [99, 111, 112, 121]
cos: [99, 111, 115]
coss: [99, 111, 115, 115]
cost: [99, 111, 115, 116]
cosy: [99, 111, 115, 121]
cot: [99, 111, 116]
cow: [99, 111, 119]
cowy: [99, 111, 119, 121]
cox: [99, 111, 120]
coy: [99, 111, 121]
coz: [99, 111, 122]
crux: [99, 114, 117, 120]
cry: [99, 114, 121]
de: [100, 101]
dee: [100, 101, 101]
deem: [100, 101, 101, 109]
deems: [100, 101, 101, 109, 115]
deep: [100, 101, 101, 112]
deeps: [100, 101, 101, 112, 115]
deer: [100, 101, 101, 114]
deers: [100, 101, 101, 114, 115]
dees: [100, 101, 101, 115]
defi: [100, 101, 102, 105]
defis: [100, 101, 102, 105, 115]
deft: [100, 101, 102, 116]
defy: [100, 101, 102, 121]
dehort: [100, 101, 104, 111, 114, 116]
dei: [100, 101, 105]
deil: [100, 101, 105, 108]
deils: [100, 101, 105, 108, 115]
deist: [100, 101, 105, 115, 116]
deity: [100, 101, 105, 116, 121]
del: [100, 101, 108]
dell: [100, 101, 108, 108]
dells: [100, 101, 108, 108, 115]
delly: [100, 101, 108, 108, 121]
dels: [100, 101, 108, 115]
demo: [100, 101, 109, 111]
demos: [100, 101, 109, 111, 115]
demy: [100, 101, 109, 121]
den: [100, 101, 110]
dens: [100, 101, 110, 115]
dent: [100, 101, 110, 116]
deny: [100, 101, 110, 121]
derry: [100, 101, 114, 114, 121]
des: [100, 101, 115]
dev: [100, 101, 118]
dew: [100, 101, 119]
dewy: [100, 101, 119, 121]
dex: [100, 101, 120]
dey: [100, 101, 121]
dhow: [100, 104, 111, 119]
dill: [100, 105, 108, 108]
dills: [100, 105, 108, 108, 115]
dilly: [100, 105, 108, 108, 121]
dim: [100, 105, 109]
dims: [100, 105, 109, 115]
din: [100, 105, 110]
dins: [100, 105, 110, 115]
dint: [100, 105, 110, 116]
dip: [100, 105, 112]
dippy: [100, 105, 112, 112, 121]
dips: [100, 105, 112, 115]
dipt: [100, 105, 112, 116]
dirt: [100, 105, 114, 116]
dirty: [100, 105, 114, 116, 121]
dit: [100, 105, 116]
ditty: [100, 105, 116, 116, 121]
divvy: [100, 105, 118, 118, 121]
do: [100, 111]
door: [100, 111, 111, 114]
doors: [100, 111, 111, 114, 115]
dopy: [100, 111, 112, 121]
dor: [100, 111, 114]
dorr: [100, 111, 114, 114]
dorrs: [100, 111, 114, 114, 115]
dors: [100, 111, 114, 115]
dorty: [100, 111, 114, 116, 121]
dory: [100, 111, 114, 121]
dos: [100, 111, 115]
doss: [100, 111, 115, 115]
dost: [100, 111, 115, 116]
dot: [100, 111, 116]
dotty: [100, 111, 116, 116, 121]
doty: [100, 111, 116, 121]
dow: [100, 111, 119]
doxy: [100, 111, 120, 121]
dry: [100, 114, 121]
eel: [101, 101, 108]
eels: [101, 101, 108, 115]
eely: [101, 101, 108, 121]
eery: [101, 101, 114, 121]
ef: [101, 102]
eff: [101, 102, 102]
efflux: [101, 102, 102, 108, 117, 120]
effort: [101, 102, 102, 111, 114, 116]
effs: [101, 102, 102, 115]
efs: [101, 102, 115]
eft: [101, 102, 116]
egg: [101, 103, 103]
eggs: [101, 103, 103, 115]
egis: [101, 103, 105, 115]
ego: [101, 103, 111]
egos: [101, 103, 111, 115]
eh: [101, 104]
el: [101, 108]
ell: [101, 108, 108]
ells: [101, 108, 108, 115]
elm: [101, 108, 109]
elms: [101, 108, 109, 115]
elmy: [101, 108, 109, 121]
els: [101, 108, 115]
em: [101, 109]
empty: [101, 109, 112, 116, 121]
ems: [101, 109, 115]
emu: [101, 109, 117]
en: [101, 110]
enow: [101, 110, 111, 119]
ens: [101, 110, 115]
envy: [101, 110, 118, 121]
er: [101, 114]
err: [101, 114, 114]
errs: [101, 114, 114, 115]
ers: [101, 114, 115]
erst: [101, 114, 115, 116]
es: [101, 115]
ess: [101, 115, 115]
et: [101, 116]
ex: [101, 120]
fil: [102, 105, 108]
fill: [102, 105, 108, 108]
fills: [102, 105, 108, 108, 115]
filly: [102, 105, 108, 108, 121]
film: [102, 105, 108, 109]
films: [102, 105, 108, 109, 115]
filmy: [102, 105, 108, 109, 121]
fils: [102, 105, 108, 115]
fin: [102, 105, 110]
finny: [102, 105, 110, 110, 121]
fins: [102, 105, 110, 115]
fir: [102, 105, 114]
firry: [102, 105, 114, 114, 121]
firs: [102, 105, 114, 115]
first: [102, 105, 114, 115, 116]
fist: [102, 105, 115, 116]
fisty: [102, 105, 115, 116, 121]
fit: [102, 105, 116]
fix: [102, 105, 120]
fiz: [102, 105, 122]
fizz: [102, 105, 122, 122]
floor: [102, 108, 111, 111, 114]
floors: [102, 108, 111, 111, 114, 115]
floosy: [102, 108, 111, 111, 115, 121]
flop: [102, 108, 111, 112]
floppy: [102, 108, 111, 112, 112, 121]
flops: [102, 108, 111, 112, 115]
floss: [102, 108, 111, 115, 115]
flossy: [102, 108, 111, 115, 115, 121]
flow: [102, 108, 111, 119]
flu: [102, 108, 117]
flux: [102, 108, 117, 120]
fly: [102, 108, 121]
foot: [102, 111, 111, 116]
footy: [102, 111, 111, 116, 121]
fop: [102, 111, 112]
fops: [102, 111, 112, 115]
for: [102, 111, 114]
fort: [102, 111, 114, 116]
forty: [102, 111, 114, 116, 121]
foss: [102, 111, 115, 115]
fou: [102, 111, 117]
fox: [102, 111, 120]
foxy: [102, 111, 120, 121]
foy: [102, 111, 121]
fry: [102, 114, 121]
fuzz: [102, 117, 122, 122]
ghi: [103, 104, 105]
ghis: [103, 104, 105, 115]
ghost: [103, 104, 111, 115, 116]
ghosty: [103, 104, 111, 115, 116, 121]
gill: [103, 105, 108, 108]
gills: [103, 105, 108, 108, 115]
gilly: [103, 105, 108, 108, 121]
gilt: [103, 105, 108, 116]
gimp: [103, 105, 109, 112]
gimps: [103, 105, 109, 112, 115]
gimpy: [103, 105, 109, 112, 121]
gin: [103, 105, 110]
ginny: [103, 105, 110, 110, 121]
gins: [103, 105, 110, 115]
gip: [103, 105, 112]
gips: [103, 105, 112, 115]
gipsy: [103, 105, 112, 115, 121]
girt: [103, 105, 114, 116]
gist: [103, 105, 115, 116]
git: [103, 105, 116]
glop: [103, 108, 111, 112]
glops: [103, 108, 111, 112, 115]
glory: [103, 108, 111, 114, 121]
gloss: [103, 108, 111, 115, 115]
glossy: [103, 108, 111, 115, 115, 121]
glost: [103, 108, 111, 115, 116]
glow: [103, 108, 111, 119]
gnu: [103, 110, 117]
go: [103, 111]
goo: [103, 111, 111]
goop: [103, 111, 111, 112]
goops: [103, 111, 111, 112, 115]
goos: [103, 111, 111, 115]
goosy: [103, 111, 111, 115, 121]
gor: [103, 111, 114]
gorsy: [103, 111, 114, 115, 121]
gory: [103, 111, 114, 121]
got: [103, 111, 116]
gox: [103, 111, 120]
goy: [103, 111, 121]
guy: [103, 117, 121]
hi: [104, 105]
hill: [104, 105, 108, 108]
hillo: [104, 105, 108, 108, 111]
hillos: [104, 105, 108, 108, 111, 115]
hills: [104, 105, 108, 108, 115]
hilly: [104, 105, 108, 108, 121]
hilt: [104, 105, 108, 116]
him: [104, 105, 109]
hin: [104, 105, 110]
hinny: [104, 105, 110, 110, 121]
hins: [104, 105, 110, 115]
hint: [104, 105, 110, 116]
hip: [104, 105, 112]
hippy: [104, 105, 112, 112, 121]
hips: [104, 105, 112, 115]
his: [104, 105, 115]
hiss: [104, 105, 115, 115]
hist: [104, 105, 115, 116]
hit: [104, 105, 116]
ho: [104, 111]
hoop: [104, 111, 111, 112]
hoops: [104, 111, 111, 112, 115]
hoot: [104, 111, 111, 116]
hooty: [104, 111, 111, 116, 121]
hop: [104, 111, 112]
hops: [104, 111, 112, 115]
horst: [104, 111, 114, 115, 116]
horsy: [104, 111, 114, 115, 121]
host: [104, 111, 115, 116]
hot: [104, 111, 116]
how: [104, 111, 119]
hoy: [104, 111, 121]
ill: [105, 108, 108]
ills: [105, 108, 108, 115]
illy: [105, 108, 108, 121]
immy: [105, 109, 109, 121]
imp: [105, 109, 112]
imps: [105, 109, 112, 115]
in: [105, 110]
inn: [105, 110, 110]
inns: [105, 110, 110, 115]
ins: [105, 110, 115]
is: [105, 115]
it: [105, 116]
ivy: [105, 118, 121]
jo: [106, 111]
joss: [106, 111, 115, 115]
jot: [106, 111, 116]
jotty: [106, 111, 116, 116, 121]
jow: [106, 111, 119]
joy: [106, 111, 121]
knop: [107, 110, 111, 112]
knops: [107, 110, 111, 112, 115]
knot: [107, 110, 111, 116]
knotty: [107, 110, 111, 116, 116, 121]
know: [107, 110, 111, 119]
kop: [107, 111, 112]
kops: [107, 111, 112, 115]
kor: [107, 111, 114]
kors: [107, 111, 114, 115]
kos: [107, 111, 115]
koss: [107, 111, 115, 115]
lo: [108, 111]
loo: [108, 111, 111]
loop: [108, 111, 111, 112]
loops: [108, 111, 111, 112, 115]
loopy: [108, 111, 111, 112, 121]
loos: [108, 111, 111, 115]
loot: [108, 111, 111, 116]
lop: [108, 111, 112]
loppy: [108, 111, 112, 112, 121]
lops: [108, 111, 112, 115]
lorry: [108, 111, 114, 114, 121]
lory: [108, 111, 114, 121]
loss: [108, 111, 115, 115]
lossy: [108, 111, 115, 115, 121]
lost: [108, 111, 115, 116]
lot: [108, 111, 116]
low: [108, 111, 119]
lox: [108, 111, 120]
lux: [108, 117, 120]
moo: [109, 111, 111]
moor: [109, 111, 111, 114]
moors: [109, 111, 111, 114, 115]
moory: [109, 111, 111, 114, 121]
moos: [109, 111, 111, 115]
moot: [109, 111, 111, 116]
mop: [109, 111, 112]
mops: [109, 111, 112, 115]
mor: [109, 111, 114]
mors: [109, 111, 114, 115]
mort: [109, 111, 114, 116]
moss: [109, 111, 115, 115]
mossy: [109, 111, 115, 115, 121]
most: [109, 111, 115, 116]
mot: [109, 111, 116]
mott: [109, 111, 116, 116]
mow: [109, 111, 119]
mu: [109, 117]
my: [109, 121]
no: [110, 111]
noo: [110, 111, 111]
nor: [110, 111, 114]
nos: [110, 111, 115]
nosy: [110, 111, 115, 121]
not: [110, 111, 116]
now: [110, 111, 119]
nu: [110, 117]
oops: [111, 111, 112, 115]
oot: [111, 111, 116]
op: [111, 112]
ops: [111, 112, 115]
opt: [111, 112, 116]
or: [111, 114]
ors: [111, 114, 115]
ort: [111, 114, 116]
os: [111, 115]
ow: [111, 119]
ox: [111, 120]
oxy: [111, 120, 121]
oy: [111, 121]
pry: [112, 114, 121]
psst: [112, 115, 115, 116]
sty: [115, 116, 121]
tux: [116, 117, 120]
$

0 コメント:

コメントを投稿

Comments on Google+: