NEWB: dividing numbers

Michal Wyrebski mwyr at o2.pl
Sun Mar 8 19:15:15 EDT 2009


Lo pisze:
> I just tried python first time.
> 
> 2/3
> 
> the result is zero

Float type must be specified explicitly:
2/3.0 or 2.0/3

In Python 3.x operators behave differently and '2/3' would give float 
number as a result.

> 
> I want the result to be .333... 

Than try: 1/3.0 because 2/3.0 will never show you that ;)


	Michal



More information about the Python-list mailing list