[Tutor] Dividing 1 by another number ?

Alan Gauld alan.gauld at freenet.co.uk
Mon Jan 31 01:35:50 CET 2005


> I'm trying to write a program they may involve needing to 
> divide 1 by another number. 

In that case you need it to use floating point numbers.
The easiest way is to use 1.0 but if it comes from a table 
or user entry you might have to explicitly convert:

one = 1
other = 42
result = float(one/other)

HTH,

Alan G.


More information about the Tutor mailing list