'' Hey, I have tried a lot to get this code, since I haven't found any solution in python, then I have tried and solved that problem. Hope this code helps you.
The question is: Given a string of words, which represents the numbers in words or textual format. You need to write a program to print the number that is reresented in words.
IP: negative sixty nine OP: -69 ''
ones=["zero","one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
    tens=["","", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"]
    teens = ["",'','','','','','','','','',"ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"]
    hun=["hundred", "thousand", "million"]
    x=input()
    a=x.split()
    val=0
    if a[0]=='negative':
        i=1
    else:
        i=0
    while(i<len(a)):
        if a[i] in ones:
            val=val+ones.index(a[i])
        elif a[i] in tens:
            val=val+((tens.index(a[i]))*10)
        elif a[i] in teens:
            val=val+(teens.index(a[i]))
        elif a[i] in hun:
            if a[i]=='hundred':
                temp=100
            elif a[i]=='thousand':
                temp=1000
            else:
                temp=1000000
            val=val*temp
        i+=1
    if a[0]=='negative':
        print(-1*val)
    else:
        print(val)