15,790,243 members
See more:
Hi there! I'm trying to write a program using functions (1 module being the function, and 1 module being the main program and importing the function) to answer this question:

zeller's congruence is an algorithm to calculate the day of the week. The formula is:

h=(q+⌊26(m+1)10⌋+k+⌊k4⌋+⌊j4⌋+5j)%7
where:

-⌊…⌋ indicates floor division
-h is the day of the week (0 - Saturday, 1 - Sunday, 2 - Monday, 3 - Tuesday, 4 - Wednesday, 5 - -Thursday, 6 - Friday)
-q is the day of the month
-m is the month (3 - March, 4 - April, ... 12 - December). January and February are counted as months 13 and 14 of the previous year, e.g. for January 25 2013, you would use the 25th day of the 13th month in 2012.
-j is the century, e.g. 20 for 2013
-k is the year of the century, e.g. 13 for 2013.

:Write a program using functions that prompts the user to enter a year (e.g. 2008), month (e.g. 1-12), and day of the month (e.g. 1-31), and then displays the name of the day of the week. For example, for year 2013, month 1, and day of month 25, the day of the week is Friday; the user inputs 2013, 1, and 25 in response to your prompts and then you calculate h which will be 6, and then output Friday. Run the program for five different dates. Testing must include different months including January and February, different centuries, and different years.

As far as my program goes this is what i have so far:

Function module:
VB
```def day(q, m, j, k,):
h =(q+(26)(m+1))/((10)+k+(k/4)+(j/4)+(5*j))%7
if h==1:
day="Sunday"
elif h==2:
day="Monday"
elif h==3:
day="Tuesday"
elif h==4:
day="Wednesday"
elif h==5:
day="Thursday"
elif h==6:
day="Friday"
else:
day="Saturday"
return day```

Main module:
VB
```import q5_function

q = int (input("enter day of the month"))
m = int (input ("enter the month"))
j = int (input("enter the century"))
k = int (input("enter the year of the century"))
day = q5_function.day(q, m, k, j)
print (day)```

This is the error message i get when trying to run the program:

enter day of the month1
enter the month1
enter the century20
enter the year of the century10

Traceback (most recent call last):
File "/Users/nathandavis9752/CP104/davi0030_a4/src/q5_main.py", line 18, in <module>
day = q5_function.day(q, m, k, j)
File "/Users/nathandavis9752/CP104/davi0030_a4/src/q5_function.py", line 13, in day
h =(q+(26)(m+1))/((10)+k+(k/4)+(j/4)+(5*j))%7
TypeError: 'int' object is not callable

Thank you all for your help!
Posted
Updated 8-Feb-15 13:10pm
v2

## Solution 1

the only thing I can see is that in all the python refs I have, it would be

Python
`h == 1:`

(note the spaces)

Im wondering if the lack of spaces (although most languages don't care) throws the parser off ...

btw, its Zeller's congruence, you've dropped the 'Z'

refs : http://www.tutorialspoint.com/python/python_if_else.htm[^]

http://stackoverflow.com/questions/19371643/python-if-elif-else-statement[^]