[Tutor] totalViruses[i] /= float(numTrials),

Dave Angel davea at davea.name
Wed Apr 24 17:52:38 CEST 2013


On 04/24/2013 10:59 AM, Sydney Shall wrote:
> //I am a beginner just learning Python.
>

Welcome to the mailing list.  I hope you enjoy your experience with Python.


> I have come across the following usage for the first time.
>
>    totalViruses[i] /= float(numTrials)
>
> Does it mean? ;  totalViruses[i] = totalViruses[i]/float(numTrials)
>
>
As the others have said, that's exactly right, at least if 
totalViruses[i] is immutable, like an int or a float.

It's a subtle distinction, but for now, just remember that it's true for 
"numbers", but that somebody might redefine one of these operators for 
other object types.  They could not do that for numbers, however.


-- 
DaveA


More information about the Tutor mailing list