Does anyone know how to convert int to float.
For some reason, it keeps on printing 0. I want it to print a specific decimal.
sum = 144 women_onboard = 314 proportion_womenclass3_survived = sum / np.size(women_onboard) print 'Proportion of women in class3 who survived is %s' % proportion_womenclass3_survived See also: How can I force division to be floating point? Division keeps rounding down to 0? for the underlying problem. Doing the conversion is the natural way to avoid this problem, but there are also other reasons why such conversion might be necessary.