+ 1

Please Explain The Working of the snippet

https://code.sololearn.com/c67RZ9x67OpF/?ref=app How does the relation operators behave with such type of values

3rd Nov 2022, 4:58 PM
Ayush Pandey
Ayush Pandey - avatar
1 Antwort
+ 3
43 or 'a' this will return 43 because very first condition is 43 which is taken as True. Suppose, You gave 0 or 'a' this will return 'a' because first condition is 0 which is taken as false. Thus, except 0 all values are taken to be true, weather be a string, integer, character, or floating point numbers. Now, about 43 and 'a' this will return the overall last true value i.e. 'a' if it were like, 'a' and 43 it would return 43. as we know 0 means false. Therefore, 0 and 'a' returns -> 0 'a' and 0 returns -> 0
3rd Nov 2022, 7:11 PM
Just Some Random Guy
Just Some Random Guy - avatar