As this (long) response says, use decimal
module:
>>> from decimal import Decimal
>>> Decimal('3.5') % Decimal('0.1')
Decimal('0.0')
>>> print(Decimal('3.5') % Decimal('0.1'))
0.0
>>> (Decimal(7)/2) % (Decimal(1)/10)
Decimal('0.0')
The problem is essentially due to the representation of floats in the system, you can read stuff about that everywhere on the Internet, and in the response linked.