Xif <[EMAIL PROTECTED]> writes:
> Ok, so keeping getCells() as an external function makes sense.
>
> But where exactly do you recommend I'd put it?
>
> In a seperate module, like I currently do, even though it's going to be the
> only piece of code contained inside that module?
I don't see any
on her nipples... ;-)
--
Jorge Godoy <[EMAIL PROTECTED]>
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Johan Geldenhuys <[EMAIL PROTECTED]> writes:
> What is the syntax if I want to work out what percentage 42 is out of 250?
If you want it as a factor to multiply / divide by something:
perc = 42/250
If you want it to "read" as percentage:
perc_100 = (42/250)*100
S
b = 250
>>> a / b
0
>>> float(a)/b
0.16801
>>>
One of the members has to be a floating point so that floating point division
is performed instead of integer division.
Be seeing you,
--
Jorge Godoy <[EMAIL PROTECTED]>
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
future__ import division
>>> 42 / 250
0.16801
>>>
Be seeing you,
--
Jorge Godoy <[EMAIL PROTECTED]>
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Pujo Aji <[EMAIL PROTECTED]> writes:
> don't forget to use dot or converge into float.
Or import division from __future__.
>>> from __future__ import division
>>> 42 / 250
0.16801
>>>
--
Jorge Godoy <[EMAIL PROTECTED]>
__
>> b = "%.2f" % a
>>> b
'16.80'
>>> float(b)
16.801
>>> str(float(b))
'16.8'
>>>
(The reason for the '0001' is because of the numeric base used to
represent data -- binary --
queues with some data in the unit test?
>From JMock's page you get to mockobject's page and from there there's a link
to Python-mock.
http://sourceforge.net/projects/python-mock
I hope it helps.
--
Jorge Godoy <[EMAIL PROTECTED]>
"Quidquid latine dictu