Skip to content
Advertisement

Python function that gives a maximum of 1.2 [closed]

I have this code here:

JavaScript

But it doesn’t let me use numbers between 0-1.9 showing an output of

JavaScript

What should I change in the function to allow decimals to be accepted?

Advertisement

Answer

Remove the conversion to an int, as this will floor your float.

JavaScript
Advertisement