【发布时间】:2012-12-12 02:41:32
【问题描述】:
我正在尝试在 python 中创建一个程序,它会使用 Zeller 算法 http://en.wikipedia.org/wiki/Zeller%27s_congruence 告诉你你出生的星期几,但它给了我这个错误
TypeError: 不支持的操作数类型 -: 'int' 和 '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
(这是我自己创建的第一个程序,请多多关照;))
【问题讨论】:
-
[year / 100]将其更改为:(year / 100),也在(day + (month + 1) * 2.6中右括号在哪里? (删除,)