You can use the function choice
module random
passing a list with all its lists as argument. What this function does is to return an element from that list randomly.
lista_de_nomes = ["João", "Maria", "Pedro", "Lucas", "Gabriela", "Paulo", "Roberta"]
nome_aleatorio = random.choice(lista_de_nomes) # Retorna um nome aleatório.
Therefore, you just need to pass all your lists to this function and then add to the returned list the data entered by the user. See the code below:
import random
A, B, C, D = [], [], [], []
for k in range(12):
nome = input('Digite seu nome: ')
numero = int(input('Um numero: '))
outro = int(input('Outro numero: '))
lista = random.choice([A, B, C, D])
lista.append(nome + " " + str(numero) +" " + str(outro))
Friend, how do I make these lists to be limited to 3 sets of name, number and other?
– HomeDown
As this is another question, create a new question on the site about.
– JeanExtreme002