Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
Your code gets a warning saying that the function binary can reach an end without returning anything. Indeed in the case search == arr[mid] you just set c=1 without returning (return in else clause is not run since it is in else clause) After you fix it changing c = 1 to return 1, you will notice that c is set only at start and you don't need it. Also on sololearn i don't get a prompt asking for input. Maybe someone who knows how the code playground works can explain why.
23rd Nov 2020, 7:13 AM
Volodymyr Chelnokov
Volodymyr Chelnokov - avatar