Write a Python program to convert true to 1 and false to 0

code:-

x = 'true'
x = int(x == 'true')
print(x)
x = 'abcd'
x = int(x == 'true')
print(x)
output:-
1
0
>>> 

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post