0
Why does this statement evaluate to True?
Can someone explain to me how bool() works when only an assignment operator is used? For example: k = " "+" " print(bool(k)) output: True
3 Respuestas
+ 1
blank space hold ascii value of 32 in python hence ur k is not an empty string and any non empty or value less variable passed to bool outputs true
+ 1
U can get ascii value of " " using ord function like
a =" "
b=ord (a)
print (b)
0
Thank you!!!