Loops

    C++                                         Python

    #include <cmath>                            import math
    for (int i = 1; i < 100; i++) {             for i in range(1,100):
        x = i;                                      x = i
        sum += log10(x);                            sum += math.log10(x)
    }


    for (int i = 10; i > 0; i--) {              for i in range(10,0,-1):
        printf("i = %d\n", i);                      print 'i =', i
    }


    int sum = 0, i = 0;                         i = 0
                                                sum = 0
    while (i < 20) {                            while i < 20:
        sum += i;                                   sum += i
        i++;                                        i += 1
    }


    i = 0;                                      i = 0
    j = 19;                                     j = 19
    while (i != j) {                            while i != j:
        i += 2;                                     i += 2
    }