Vetores Intercalados

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Vetor1 = []

Vetor2 = []
Vetor3 = []
i = 0

Vetor1 = input().strip().split(" ")


Vetor2 = input().strip().split(" ")

Quant_vetor1 = int(Vetor1[0])
del Vetor1[0]
Quant_vetor2 = int(Vetor2[0])
del Vetor2[0]

if (Quant_vetor1 > Quant_vetor2):


for x, y in zip(Vetor1, Vetor2):
Vetor3.append(x)
Vetor3.append(y)
#print(i)
i += 1

print(*Vetor1)

if (len(Vetor2) > 2):


while (Quant_vetor1 != Quant_vetor2):
x = 0
del Vetor1[x]
x += 1
Quant_vetor1 -= 1
for z in Vetor1:
Vetor3.append(z)
else:
for x in range(i, len(Vetor1)):
Vetor3.append(Vetor1[x])

#for z in Vetor1:
# Vetor3.append(z)

print(*Vetor2)

print(*Vetor3)

if (Quant_vetor1 < Quant_vetor2):


for x, y in zip(Vetor1, Vetor2):
Vetor3.append(x)
Vetor3.append(y)

print(*Vetor1)
print(*Vetor2)

while (Quant_vetor1 != 0):


x = 0
del Vetor2[x]
x += 1
Quant_vetor1 -= 1
for z in Vetor2:
Vetor3.append(z)

print(*Vetor3)

You might also like