3
Contributors
2
Replies
25
Views
2 Months
Discussion Span
Last Post by ddanbe
0

The trick is often to convert the number to a float

>>> ispeed = 1        # <--- integer speed
>>> fspeed = 0.5      # <--- float speed
>>> sspeed = "0.8"    # <--- string speed
>>> ispeed = float(ispeed)
>>> fspeed = float(fspeed)
>>> sspeed = float(sspeed)
>>> print(ispeed, fspeed, sspeed)
1.0 0.5 0.8

After applying float(), all the speeds are floating numbers.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.