Help with some python homework...
Scott W Dunning
swdunning at cox.net
Fri Jan 31 19:46:43 EST 2014
Also, can any of you reccommend sites that may have little “projects” that I could work on to help me learn python better?
On Jan 31, 2014, at 1:30 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Fri, Jan 31, 2014 at 7:17 PM, Gregory Ewing
> <greg.ewing at canterbury.ac.nz> wrote:
>> sjud9227 wrote:
>>>
>>> Doesn't
>>> assigning seconds/(60*60) mean that calculating 6*hours will give me 6
>>> hours
>>> in seconds?
>>
>> No, it's giving you 6 seconds in hours. (That should
>> give you a clue as to what you should have done
>> instead. :-)
>>
>> ...
>>
>> a // b gives the quotient of dividing a by b
>>
>> a % b gives the remainder
>>
>> (I recommend using '//' rather than just '/', because
>> in some versions of Python, a/b does floating point
>> division even if a and b are both integers, and that's
>> not what you want here.)
>
> OP is using 2.7.6, so short of a __future__ directive, that won't
> actually give 6 seconds in hours (though it will try to), and // is
> unnecessary.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list