Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Basic python programming

I don't know what is wrong. I tells me I have a string formatting error where a = y % 19 and then it also tells me I have something wrong with the module when I am calling the main(). No clue on how to fix this because it seems I am calling the main() function correctly and the string seems fine.

def main():

    y = input("Enter year: ")
    print ("y = ", y)

    a = y % 19
    print ("a = ", a)

    b = y / 100
    print ("b = ", b)

    c = y % 100
    print ("c = ", c)

    d = b / 4
    print ("d = ", d)

    e = b % 4
    print ("e = ", e)

    g = (8 * b + 13) / 25
    print ("g = ", g)

    h = (19 * a + b - d - g + 15) / 30
    print ("h = ", h)

    j = c / 4
    print ("j = ", j)

    k = c % 4
    print ("k = ", k)

    m = (a + 11 * h) / 319
    print ("m = ", m)

    r = (2 * e + 2 * j - k - h + m + 32)  % 7
    print ("r = ", r)

    n = (h - m + r + 90) / 25
    print ("n = ", n)

    p = (h - m + r + n + 19) % 32
    print ("p = ", p)

    print ("In ", y, "Easter Sunday is on", p,)
    if (n == 3):
        print ("March")
    if (n == 4):
        print ("April")

main()

Answer*

Draft saved
Draft discarded

Required fields are marked with *

Cancel

lang-py