Project Euler problem#17

#python program to print letters count from 1 to 1000
sum=0
num={}
a=['one','two','three','four','five','six','seven','eight','nine']
b=['ten','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninety','onehundred']
c=['eleven', 'twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
for i in range(1,1001):
    if i<10:
        j=a[i-1]
        num[i]=j
        sum+=len(j)
    elif i>10 and i<20:
        j=c[(i%10)-1]
        num[i]=j       
        sum+=len(j)
    elif i<101 and i%10==0:
        j=b[(int(i/10))-1]
        num[i]=j
        sum+=len(j)    
    elif i>20 and i<100:
        j=int(str(i)[0])
        j=b[j-1]
        k=int(str(i)[1])
        k=a[k-1]
        num[i]=j+k        
        sum+=len(j+k)
    elif i>100 and i<1000:
        j=int(str(i)[0])
        j=a[j-1]
        if int(str(i)[1])==0 and int(str(i)[2])!=0:
            k=int(str(i)[2])
            k=a[k-1]
            sum+=3+len(j+k)+7
        elif int(str(i)[1])==0 and int(str(i)[2])==0:
            sum+=len(j)+7
        else:
            k=num[int(str(i)[1:])] 
            sum+=3+len(j+k)+7
    else:
        sum+=11   # for 1000      

print(sum)