Python not equal to 0
Python not equal to 0
I am new to Python. How can I know if a function is being used or not; if it is not equal to zero then the program will print; otherwise, do not print any zero.
2 Answers
2
You are almost there... but you need to use != and : in your if statement
Using the 'if' statement :-
b1 = (int(a1[0]) + int(a2[0])) // 10
if b1!=0:
print(b1)
use != for condition check
b1 = (int(a1[0]) + int(a2[0])) // 10
if b1 != 0:
print (b1)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
@shaa5 I hope it helps you if it is please accept as an answer. For further query ask
– iamsankalp89
Aug 28 at 5:03