Make a program that creates two vectors with 10 random elements between 1 and 100. Generate a third vector of 20 elements, whose values should be composed of the interleaved elements of the two other vectors. Print the three vectors.
I would like to know if the code I made is correct and if possible show me another way to thank you.
import random
lista1 = []
lista2 = []
lista3 = []
while len(lista1) < 10:
numero = random.randint(1,100)
if numero not in lista1:
lista1.append(numero)
lista3.append(numero)
while len(lista2) < 10:
numero = random.randint(1,100)
if numero not in lista2:
lista2.append(numero)
lista3.append(numero)
lista1.sort()
lista2.sort()
lista3.sort()
print(lista1)
print(lista2)
print(lista3)