New answers tagged


In my opinion, solution 1 is better than solution 2. The simple reason for that is the overall performance. Any code which reduces the number of iteration is good for any application. Solution 1 does the same as if condition returns false then it will reduce the number of iterations.


something like that? #include <iostream> float f(float D, float R){ return D/R; } int main(){ int R = 41; int iterations_cnt=0; float previous_g_value, g=0; bool solution_found = false; for(int i=1;i<=100 && ! solution_found;i++){ for(int j=1; j<=50 && ! solution_found; j++){ for(int k=1;k&...


because in this case num (having the value 1) evaluates to True. Try something like: if x: print("true") else: print("false") print(e(0), e(2), e("a"))

Top 50 recent answers are included