import sys
list1 = []
list2 = []
# 把輸入的羅馬數字數字轉換相加
con_l_number = {'I':1, 'V':5, 'X':10, 'L':50, 'C':100, 'D':500, 'M':1000,' ':0}#羅馬數字轉換
for a in sys.stdin:
aa = a.split()
list1 = [con_l_number[c]for c in aa[0]]#輸入去配對字典裡的資料轉換
for i in range(len(list1)-1):
if list1[i] < list1[i + 1]:
list1[i] *= -1
list2 = [con_l_number[c]for c in aa[1]]#輸入去配對字典裡的資料轉換
for x in range(len(list2)-1):
if list2[x] < list2[x + 1]:
list2[x] *= -1
sum_num1 = sum(list1)
sum_num2 = sum(list2)
print(sum_num1 - sum_num2)
想請問為甚麼list1 = [con_l_number[c]for c in aa[0]]這句的FOR迴圈永遠都不會執行,他都沒進去fOR迴圈裡
分開打是因為題目會把兩個字串中間空白所以要相減,所以就分開儲存,然後把兩個字串相減,求解,請指教