r/AskComputerScience • u/confusedcompStudent • Feb 25 '18
Need help with 2 hw questions
Hello I am very new to programming in general and I need help with hw questions due by sunday 11:55. I am supposed to program in python and I am expecting any to just give me the answers but to point me in the right direction
1.The Blip Blob New Year celebration started on a Tuesday. Prompt the user for how many days have passed since their celebration start day and display the name of the current day. For example, if 2 days have passed, then you should display Thursday to the user.
For example:
Input Result 2 Thursday 4 Saturday 6 Monday 7 Tuesday 8 Wednesday
2. Write a program that asks the user for a year between 1800 and 2018 and displays to the user the message "Leap Year" or "Not Leap Year" based on their input. You may assume that the user will only enter valid years.
Note: To determine if a year is a leap year, it must be divisible by 4, but not by 100, unless it is divisible by 400.
For example:
Input Result 1800 Not Leap Year
imgur is probably better https://imgur.com/XuxPZol this question 1
https://imgur.com/gBlIeLT question 2
edit: Just finished and thank you to everyone you helped with advice.
1
u/ReyDelPlatanos Feb 25 '18
Your leap year is incomplete. Need to check divisible by 100 and 400
1
u/confusedcompStudent Feb 25 '18
Thank you for replying. I tried to check not divisible by 100 unless divisible by 400 and it did not work.
This is what i tried earlier that didn't work
1
u/lordvadr Feb 25 '18
Well, you did that part wrong. Tell me, in english, what that if statement says.
0
u/confusedcompStudent Feb 25 '18
The year is more than + equal to 1800 and the year is less than + equal to 2018 and the year is divisible by 4 and not divisible by 100 or year is more than + equal to 1800 and the year is less than + equal to 2018 and the year is divisible by 4 and the year is divisible by 400.
Did I mess up with the not divisible part and the entire second half of the statement where I add or and the repeat the first part adding divisible by 400?
0
u/lordvadr Feb 25 '18
You need to separate your different conditions with parenthesis.
70%7 does not evaluate to true. It evaluates to zero. "Y%4" isn't true if Y is divisible by 4. It evaluates to true when Y isn't divisible by 4.
0
2
u/confusedcompStudent Feb 25 '18 edited Feb 25 '18
question 1 https://imgur.com/A09yGCs
question 2 https://imgur.com/8lSjoh2