+ 1

Anyone can help me with this?

#py a= "False" b="True" if bool(a)==bool(b): print(bool(a)) print(bool(b))

6th Jan 2021, 3:20 PM
Surkhab Khan
Surkhab Khan - avatar
3 Réponses
+ 2
Boolean value of a string will be False only if your string is empty. This applies to lists, tuples, dictionaries, sets too.
6th Jan 2021, 3:49 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 1
Surkhab Khan You've used the string data type instead of the boolean data type, which doesn't include the quotes. Any value other than None (which includes ""), False or 0 returns True. Try using them without the quotes.
6th Jan 2021, 4:48 PM
Calvin Thomas
Calvin Thomas - avatar