Click here to Skip to main content
15,846,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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:


-⌊…⌋ 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:
def day(q, m, j, k,):
    h =(q+(26)(m+1))/((10)+k+(k/4)+(j/4)+(5*j))%7
    if h==1:
    elif h==2:
    elif h==3:
    elif h==4:
    elif h==5:
    elif h==6:
    return day

Main module:
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 =, 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/", line 18, in <module>
day =, m, k, j)
File "/Users/nathandavis9752/CP104/davi0030_a4/src/", 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!
Updated 8-Feb-15 13:10pm

1 solution

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

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 :[^][^]
Share this answer
Member 11417510 8-Feb-15 17:57pm    
Sadly still not the solution i am looking for... I have no idea why this is happening.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900