[Tutor] Python Assignment Question
aijathompson at hotmail.com
Mon Sep 24 21:20:34 CEST 2012
I've been working on this question for a long time and for some reason it's just not clicking.
I'm not sure if my loop for the question is the right one, or if I'm even on the right track.
We're supposed to make a program that counts the number of days into the year it is if you input a date. Not including leap years.
This is what I have so far:
months = 'January, February, March, April, May, June, July, August, September, October, November, December'daysPerMonth = '31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31' #shorterMonths = 'February, April, June, September, Novmeber'#longerMonths = 'January, March, May, July, August, October, December'
month = raw_input('Enter the month: ')day = raw_input('Enter the day: ')
for x in month: whichMonth = months.index(x) monthNumber = daysPerMonth[whichMonth] dayYear.append(monthNumber)
I was hoping to make a loop that would check which month it is and compare it to the second list I made with the number of days in that month. I don't know if I've made that clear to the program or not. Either way, I feel pretty lost at the moment.
Any help would do!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor