An algorithm to figure this out originally was invented by the mathematician Carl Friedrich Gauss. It has a lot of steps, but they are simple ones.
a = 6 b = 20 c = 1 d = 5 e = 0 g = 6 h = 18 j = 0 k = 1 m = 0 r = 6 n = 4 p = 15Hence in 2001, Easter Sunday was on April 15. (BTW: You might add print statements to print the intermediate results to see if you're on the right track. But remove them or comment them out before you submit.) Also, remember that to get a quotient you should use integer division, not real division. If you need both quotient and remainder, you'll do that in two steps.
In your program you will prompt the user to enter the year and then write out the date for Easter Sunday.
Update: I hadn't realized that the input function is not covered until slideset 3. Sorry about that! You can use the following code:
y = int( input("Enter year: ") )This will print the prompt "Enter year: ", and wait for the user to enter a number. This number will actually arrive as a string, say "2001". Then the function int() will convert that string into an integer which will be stored in the variable y. From there you're good to go.
You can assume that the year entered is a positive integer. Your session must look exactly like the following. Any deviations in the format of the output will result in points being deducted.
Enter year: 2001 In 2001 Easter Sunday is on month 4 and day 15You can type "Easter 2001" (or any other year) into Google to verify that your program is giving you the correct result.
It's usually bad programming practice in most cases to use single letter variable names. However, the variables in this problem don't have much obvious individual meanings, so go ahead and just use the variable names given.
Your file must compile and run before submission. It must also contain a header with the following format:
# File: EasterSunday.py # Student: # UT EID: # Course Name: CS303E # # Date Created: # Date Last Modified: # Description of Program:
If you submit multiple times to Canvas, it will rename your file name to something like EasterSunday-1.py, EasterSunday-2.py, etc. Don't worry about that; we'll grade the latest version.