Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
2.4 kB
1
Indexable
Never
number_dict = {
    "zero": 0,
    "one": 1,
    "two": 2,
    "three": 3,
    "four": 4,
    "five": 5,
    "six": 6,
    "seven": 7,
    "eight": 8,
    "nine": 9,
    "ten": 10,
    "eleven": 11,
    "twelve": 12,
    "thirteen": 13,
    "fourteen": 14,
    "fifteen": 15,
    "sixteen": 16,
    "seventeen": 17,
    "eighteen": 18,
    "nineteen": 19,
    "twenty": 20,
    "twenty one": 21,
    "twenty two": 22,
    "twenty three": 23,
    "twenty four": 24,
    "twenty five": 25,
    "twenty six": 26,
    "twenty seven": 27,
    "twenty eight": 28,
    "twenty nine": 29,
    "thirty": 30,
    "thirty one": 31,
    "thirty two": 32,
    "thirty three": 33,
    "thirty four": 34,
    "thirty five": 35,
    "thirty six": 36,
    "thirty seven": 37,
    "thirty eight": 38,
    "thirty nine": 39,
    "forty": 40,
    "forty one": 41,
    "forty two": 42,
    "forty three": 43,
    "forty four": 44,
    "forty five": 45,
    "forty six": 46,
    "forty seven": 47,
    "forty eight": 48,
    "forty nine": 49,
    "fifty": 50,
    "fifty one": 51,
    "fifty two": 52,
    "fifty three": 53,
    "fifty four": 54,
    "fifty five": 55,
    "fifty six": 56,
    "fifty seven": 57,
    "fifty eight": 58,
    "fifty nine": 59}

def forC(s):
    s = s.replace('"', '')
    s = s.replace("math|", "")
    if "|" in s:
        s = s.split("|")
        s = f'{number_dict[s[1]]}'
    
    return s

s='''"string-number|zero" "string-number|two" "math|23-3/87%29+41" "math|10+49+30-12" "math|58-72-9/50*16*25" "math|((98%40+81+89)+(32+3/61+59)+(8+57+76))+((99+18-107)*(5+59))+((38-75%103)*(105%102/105)/98+(26-5+15+75))-((90/7+29+70)/29-(68*10+94+108))" "string-number|nine" "string-number|zero" "math|57-100+39" "math|((23+80-84)+(11+107))+((27+64)+(79+40+74+39))/74" "math|47*20" "string-number|six" "math|92+83+105+34+108/76" "math|((87%96)-(101+19%59*29))+((31%42)%109-(54+86)+(6/41))" "math|((73+85)+(28-23+44+107))/33" "math|((67-87*69/65)*(88+93*70-74))+((105-45)*(69+49)+(37+70))" "math|33*38%39" "math|83-38-67+8-100" "string-number|zero" "math|((58-53-81+86)/84-(25+53-29))+((56*65*39-68)+(60+62))+((73/104-54-66)+(0+36/13%33))" "math|((37+48+4)-(103/75)+(26+77*2)*(46*33))-((32/53*6)+(28+55+26))*((80-52-53)-(67+69+61)+(14+9+68+65))/103" "string-number|zero"'''

for i in s.split():
    print(forC(i), end=' ')
Leave a Comment