def babylonian(symbols):
table=[["T",1], ["<",10],["\\",0]]
returning=0
for pair in table:
forTrue=True
while forTrue:
if len(symbols)>=len(pair[0]):
if symbols[0:len(pair[0])]==pair[0]:
returning+=pair[1]
symbols=symbols[len(pair[0]):]
else:
forTrue=False
else:
forTrue=False
return returning
Hello, what will I have to do so I can get an output similar to this:
print(babylonian(['TT', '<<']))
# should output [2,10]
print(babylonian(['<<T', 'TTT', '//', '<<<<TTT']))
# should output [21,3,0,43]
Currently I can only output the numerals from the tables and if I try to stack ex. TT
, <<
I get an output of 0.