[Tutor] Python Assignment Question

Dave Angel d at davea.name
Mon Sep 24 23:13:44 CEST 2012

On 09/24/2012 04:56 PM, Aija Thompson wrote:
> Hi,

By top-posting, you lose all the context.  The convention is to quote
those parts of the previous messages necessary to understand the
context, and then add your own remarks immediately after the appropriate

> Yeah this is my first assignment and I've never worked on anything programming before.
> I am working in Python 2.7
> The shorter and longer months thing is just a not to myself, that is why it has the hash tag before he sentence.
> But my initial plan was to make a string of months

Fine.  Have you played with it?  Try something like this to get an idea
what you have:

months = 'January, February, March, April, May, June, July, August,
September, October, November, December'
for amonth in months:
    print amonth

See what's wrong?  Can you imagine what the difference might be if it
were a list of strings?

Once you get that, try the same kind of experimenting with the other
anomalies I pointed out.

I expect you haven't gotten a feeling for what all the various native
types are good for, list, string, int, float.

Are you also familiar with what int() does to a string?  What def
functions are?

I'm sorry if i seem harsh, but this seems like a tough first assignment.
 You have to use a dozen concepts you apparently haven't wielded before.
 Weren't there exercises in the chapters you've been studying?  Did you
try every one of them?

I'm actually somewhat envious of the way people get to try out computer
programs today.  That wasn't an option when I started.  So take
advantage of it.  Write tiny programs and see whether they work, then
figure out why not and fix them.

 and a string of the number of days in those months and have them
compare to each other. So it would go through a loop and if you typed in
February it would look through the list of numbers and see that January
comes before and has 31 days and would add the number of days in
February it has been. For instance 22. And it would add 22 to 31 to come
up with how many days it has been this year so far.  So I've been trying
to make that work some way but I have so far been pretty unsuccesful.
Does the way I'm even thinking about making the loop make sense?
> Thanks!



More information about the Tutor mailing list