concatenate two elements as 1 element for example we are given two arrays a and b:
a=[1,2,3]
b=[4,5,6]
so what I want is an output as
14, 25, 36
concatenate two elements as 1 element for example we are given two arrays a and b:
a=[1,2,3]
b=[4,5,6]
so what I want is an output as
14, 25, 36
If a
and b
are lists of integers, you could do the following:
c = [i * 10 + j for i, j in zip(a, b)]
If they are lists of strings, you could do the following:
c = [i + j for i, j in zip(a, b)]
result = [int(f'{x}{y}') for x, y in zip(a, b)]