cast the for loop to integer for python3