Tridip C. answered 08/05/20
Tutor
4.9
(332)
5+ years of Experience in Programming in Python
There are multiple ways of doing it.
Let's consider two variables as follows:
a = 10
b = 3
Method #1: by explicitly converting one of them to float
c = float(a) / b
Method #2: by multiplying 1.0 to one of the numbers
c = a * 1.0 / b