Not quite sure what I'm doing wrong. Using Python 3.2 Get the issue: TypeError: list indices must be integers, not list
Here's my code.
print('Please input your first Roman Numeral.')
ri1 = input()
def romantointeger(x):
conversion = [['M',1000],['CM',900],['D',500],['CD',400],['C',100],['XC',90],['L',50],['XL',40],['X',10]] #creates Roman numer values
retint = 0 #creates the variable that will eventually be returned as the final value
for pair in conversion:
cont = True #makes it continue for a pair
while cont:
if len(x) >= len(pair): #checks the length to see if it is greater than a pair of [0]
if x[0:len(pair)]:
retint += conversion[pair]
string = string[len(pair):]
else:
cont = False
else:
cont = False
return retint
romantointeger(ri1)