Hi everyone, I'm new here and I'm looking forward to seeing how everyone codes in python. I'm a complete newbie, who has never done any programming in his whole life (except for the past 2 week). I read the guidelines about asking for help on assignments, and I wouldn't have posted here unless I was completely stuck. I'm hoping someone here can give me some tips or get me started. I basically have to create a program that tells me how many days have passed in the date the user input. Here's an example:
Enter a date in the form YYYY/MM/DD: 2000/01/01
2000/01/01 is day 1 of the year 2000.
Here is another example:
Enter a date in the form YYYY/MM/DD: 2007/09/05
2007/09/05 is day 248 of the year 2007.
I'll have to worry about leap years later, but I want to get the basics first. I'm so jumbled and confused on what codes I should use. So far, we were only taught the very basics of, "print/raw_input/if/elif/else/while & for loops/random/variables"
We were told to use string indexing but i'm not sure how I should use it because we weren't taught during class.
Here's what I have so far....if anyone can shed some light, it would be soooo much appreciated. And again, I'm in a Psychology Major and I have zero experience with coding which makes this so frustrating.
print "Enter a date in the form YYYY/MM/DD:"
date = int(raw_input("Enter a date in the form YYYY/MM/DD:"))
if date == "":
#the number of days at the start of each month
print date[26:30] + "/" + date[31:33] + "/" + date[34:36]
date = int(raw_input("Enter a date in the form: YYYY/MM/DD:"))
print date[41:45],date[46:48],date[49:51], "is day", "???", "of the year."
I know that I have everything everywhere, but I guess I need a starting point. I'm so lost. Thanks everyone in advance!
p.s. - I finished the program of guessing a random number the computer generated and it feels so good to complete a program. =)