A for loop that adds the first input times 10 ^ x (x being times looped).
Example: input1 = 12 input2(x) = 3
the anwser will be 12*10^0 + 12*10^1 + 12*10^3 = 12 + 120 + 1200 + 12000 = 13332
Try inputing 12 and 3 yourself!
def shift(a,b):
ans = 0
for i in range(b+1):
ans += a*pow(10,i)
print(ans)
N = int(input())
M = int(input())
shift(N,M)
コメント