Please explain this question 👇👇 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 13

Please explain this question 👇👇

https://code.sololearn.com/cq3Gs36uyGkf/?ref=app

29th Aug 2020, 1:20 PM
Sâñtôsh
Sâñtôsh - avatar
12 Answers
+ 13
At first You're concat-ing two empty strings. k = "" + ""# two empty strings results in another empty string. So the bool(k) will return False bcoz empty variables are False. But in the second case u concat two white spaces. k = " " + " "#True So bool(k) returns True coz k is not empty here.
29th Aug 2020, 1:29 PM
MSN
MSN - avatar
+ 6
bool(" ") => True, because there is a space character. bool("") => False, because the string is empty.
29th Aug 2020, 1:29 PM
viknesh vikky
viknesh vikky - avatar
+ 6
Såñtösh Màràvi add a 'solved' tag to prevent any more answers If you got the solution
29th Aug 2020, 1:37 PM
Namit Jain
Namit Jain - avatar
+ 5
MSN👑 Jason Sikes Web-Learner viknesh vikky thank you so much all of you. Mithlesh Gautam don't copy anyone answer
29th Aug 2020, 1:36 PM
Sâñtôsh
Sâñtôsh - avatar
+ 4
0 allways return false And( ""+"" ="" )an empty strings also returns false in bool.
30th Aug 2020, 3:39 PM
Vijay(v-star🌟)
Vijay(v-star🌟) - avatar
+ 3
First, ""+""="" Empty string together with 0 is False. Second, " "+" "=" " (Two spaces) Two spaces>0 --> True.
29th Aug 2020, 1:29 PM
Web-Learner
+ 1
Spaces are not "nothing" they count as a single byte thus represents a "thing" so space == space is true " " represents a space. But "" is nothing. So nothing is false
31st Aug 2020, 4:33 AM
Jason Kennedy
+ 1
ALL "" <==> False It's called sym-ent-ix it's not C-type language it's parallel language. ON SAKE OF HELP
31st Aug 2020, 9:10 AM
DHANANJAY PATEL
DHANANJAY PATEL - avatar
0
Try k="+" not '''+'''
29th Aug 2020, 1:28 PM
Jason Sikes
Jason Sikes - avatar
0
Spaces are counted...
31st Aug 2020, 8:23 AM
David Sontu
David Sontu - avatar
0
Sir
31st Aug 2020, 8:36 AM
Mithlesh Gautam
Mithlesh Gautam - avatar
0
Try k="+"not ":+":
31st Aug 2020, 8:37 AM
Mithlesh Gautam
Mithlesh Gautam - avatar