I came across a very simple Python Quiz question in a newsgroup, so thought about expanding on that.
Assuming, you are attending an interview and this question is asked. What would be your answer ?
[ Remember : you need to give this answer from memory and not by trying out this code :-) ]
And, as in any good interview, you are asked to explain your answer as well :-)
Post your answers in the comments below
Assuming, you are attending an interview and this question is asked. What would be your answer ?
[ Remember : you need to give this answer from memory and not by trying out this code :-) ]
>>> def foo(num) : print num; return num
...
>>>
>>> foo(5) * foo(1) * foo(2)
5
1
2
10
>>> foo(5) ** foo(1) ** foo(2)
And, as in any good interview, you are asked to explain your answer as well :-)
Post your answers in the comments below