I hoped that the values printed would be "200!" and "404!" in Python3.4. But I got the results "200!" and "else!".
I made a strange face — and tried it again in C. The results in C are not the same as those in Python3. Why?
Python3.4 code
def chk(s):
if s is 200:
print('200!')
elif s is 404:
print('404!')
else:
print('else!')
chk(200)
chk(404)
Python3.4 code result
200!
else!
C code
#include <stdio.h>
void chk(int s) {
if (s == 200)
printf("200!");
else if (s == 404)
printf("404!");
else
printf("else!");
}
int main(void) {
chk(200);
chk(404);
return 0;
}
C code result
200!404!