Q:

How to print (join) 2 loops' result

I have 2 loops:
The first loop:
number = 1234567
number_string = str(number)
for ch in number_string:
    print(ch)

This will print:
1 
2 
3 
4 
5 
6 
7

I have another loop which is:
totalNum = len(str(abs(number)))
for i in range(totalNum, 0, -1):
  print("* 10^ ",int(i-1))

and I will get 
* 10^  6
* 10^  5
* 10^  4
* 10^  3
* 10^  2
* 10^  1
* 10^  0

But how do I join these 2 loops to become the result like this:
1 * 10^  6
2 * 10^  5
3 * 10^  4
4 * 10^  3
5 * 10^  2
6 * 10^  1
7 * 10^  0

I am new to Python, so I couldn't figure out how to do that.

A:

How does this work for you:
number = 1234567
totalNum = len(str(abs(number)))
for i in range(totalNum, 0, -1):
  print(str(number)[::-1][i-1] + " * 10^ ",int(i-1))

Output:
1 * 10^  6
2 * 10^  5
3 * 10^  4
4 * 10^  3
5 * 10^  2
6 * 10^  1
7 * 10^  0

A:

Several ways to do this, mine uses enumerate() to index the string:
number = 1234567
number_string = str(number)
totalNum = len(str(abs(number)))

for j,i in enumerate(range(totalNum, 0, -1)):
  print(number_string[j], "* 10^ ", int(i-1))

Gives:
1 * 10^  6
2 * 10^  5
3 * 10^  4
4 * 10^  3
5 * 10^  2
6 * 10^  1
7 * 10^  0

enumerate() iterates through a sequence and gives a tuple of the index number (j) and the item (i).

