How to use 'range float python' in Python

Every line of 'range float python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
48def range_check(value):
49 """ Checks that *value* can be converted to a value in the range 0.0 to 1.0.
50
51 If so, it returns the floating point value; otherwise, it raises a
52 TraitError.
53 """
54 value = float(value)
55 if 0.0 <= value <= 1.0:
56 return value
57 raise TraitError
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets