我試圖在python中創建一個程序,它會告訴你使用Zeller算法的出生周的那一天http://en.wikipedia.org/wiki/Zeller%27s_congruence但它是給我這個錯誤TypeError:不支持的操作數類型爲 - :'int'和'list'
TypeError: unsupported operand type(s) for -: 'int' and 'list'
這是爲什麼?
date = raw_input ("Introduce here the day, month and year you were born like this: DDMMYYYY")
if date.isdigit() and len(date) == 8:
day = date[0:2]
month = date[2:4]
year = date[4:8]
day = int(day)
month = int(month)
year = int(year)
result = (day + (month + 1) * 2.6, + year % 100 + (year % 100)/4 - 2 * [year/100]) % 7
(這是第一個程序我自己創造,所以是很好的,請;))
'[年/ 100]'將其改爲:(年/ 100)',同樣在'(日+(月+ 1)* 2.6'中,右括號是什麼? (刪除',') –