-1

The value of A is

A = 0.4000070095062256

and after that I have the below code to check the value of A

if (A == 0.400):
    print('pass')
else:
    print('Fail')

I want to print Pass. The above code is printing Fail every time. How will i get approx value of A??

Note: In the condition I have to check the value of A with exactly equal to 0.400. and I mean to say I need approx value of A in float.

0

1 Answer 1

1

You could check, if the distance to 0.4 is less than a given limit, e.g.:

if abs(A - 0.4) < 0.0001:
    print("Pass")
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.