untrue for anything else from 0 to 100

Jan 13, 2010 03:25

There are forty-seven letters in this sentence.


#! /usr/bin/python

num = []
for ten in ['', 'teen', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninetey']:
num.append(ten)
for one in ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']:
num.append((one + ten) if ten is 'teen' else (ten + ('-' if len(ten) else '') + one))
for i in [(0, 'zero'), (10, 'ten'), (11, 'eleven'), (12, 'twelve'), (13, 'thirteen'), (15, 'fifteen'), (18, 'eighteen')]:
num[i[0]] = i[1]

for i, e in zip(range(len(num)), num):
sen = 'There are %s letters in this sentence.' % e
if i == len(sen):
print sen, '(%d)' % len(sen)
As usual, it's his fault.
Previous post Next post
Up