Why the answer for the below code
def myfunc(text, num): while num > 0: print (text) num = num - 1 myfunc ('Quantra', 4) is 'Infinite Loop'? Why is it not - 'QuantraQuantraQuantraQuantra' ?
Why the answer for the below code
def myfunc(text, num): while num > 0: print (text) num = num - 1 myfunc ('Quantra', 4) is 'Infinite Loop'? Why is it not - 'QuantraQuantraQuantraQuantra' ?
Hello Kanika, I was able to reproduce
Quantra
Quantra
Quantra
Quantra
as output with this code. Did you run this in a python file or jupyter notebook? If it was a jupyter notebook try restarting the kernel. It is possible that the kernel process hanged.
Hello Akshay, I am getting this response too in the Jupyter Notebook.
But the answer in Section 5, Unit-7 of the 'Quant Interview Question Preparation' course of Quantra says that this answer is wrong and the correct answer according to the course is 'Infinte Loop'.
Thanks for pointing out Kanika we'll make that change. Much appriciated.