Q. Are these values equal? Why/why not?
(i) 20 and 20.0
(ii) 20 and int(20)
(iii) str(20) and str(20.0)
(iv) 'a' and "a”
Answer =
(i) according to == operator it is True. But according to is operator it is not True, because due to different memory location.
(ii) According to == and is operator it is True because of same memory location.
(iii) here it is False for == and is operator because of different length of string .
(iv) according to == and is operator it is True , because of same memory location .
You can uderstand by watching videos -----
You can uderstand by watching videos -----
Thank you for answers
ReplyDeleteWelcome : )
DeleteThank you for answers
ReplyDeleteWelcome : )
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )