Exemplo n.º 1
0
def SumRange():
    sum = 0
    for num in range(1,1001):
        words = to_card(num)
        numChars = SumChars(words)
        print words + " [" + str(numChars) + "] "
    
        sum += numChars
    return sum
Exemplo n.º 2
0
def letter_counts(n):
    count = 0
    for i in range(1, n+1):
        count += count_letters(num.to_card(i))
    
    return count
Exemplo n.º 3
0
def to_card(number):
    return num2word_EN.to_card(number)
from num2word_EN import to_card

result = 0

for n in xrange(1,1001):
    number_word = to_card(n)
    print number_word
    result += len([x for x in number_word if x.isalpha()])

print result
from num2word_EN import to_card

result = 0

for n in xrange(1, 1001):
    number_word = to_card(n)
    print number_word
    result += len([x for x in number_word if x.isalpha()])

print result
Exemplo n.º 6
0
        else: now_hour  = now.hour        
        options[opt] = str(now_hour)
        if now_hour<10:
            options[opt] = "0"+options[opt]
        text = text.replace(opt,options[opt],1)
        
    elif opt == "%num_hours"  and options[opt]>-1:
        options[opt] = str(now.hour)
        if now.hour<10:
            options[opt] = "0"+options[opt]
        text = text.replace(opt,options[opt],1)

    elif opt == "%txt12_hours"  and options[opt]>-1:
        if now.hour >12: now_hour=now.hour-12
        else: now_hour = now.hour
        options[opt] = to_card(now_hour)
        text = text.replace(opt,options[opt],1)
        
    elif opt == "%txt_hours"  and options[opt]>-1 and text.find(opt) >-1:
        options[opt] = to_card(now.hour)
        text = text.replace(opt,options[opt],1)

    elif opt == "%num_minutes"  and options[opt]>-1:
        options[opt] = str(now.minute)
        text = text.replace(opt,options[opt],1)

    elif opt == "%txt_minutes"  and options[opt]>-1:
        options[opt] = to_card(now.minute)
        text = text.replace(opt,options[opt],1)

    elif opt == "%num_seconds"  and options[opt]>-1: