In python if I divide 6/3 I get 2, that's fine. But I divide 6/4 and get 1...
Why aren't I getting a decimal? I would like to know because I want to make something that can detect wether or not a number is whole. (I need help with that too). But I thought I would give it a shot myself and found that it wont give me a decimal when it should.
Thanks
Here is one way to do this:
a = 6
b = 4
# assure a float division
print a/float(b) # 1.5
# test for integer (whole number)
print type(a) == int # True