Easy
x = ['python', 'c++', 'JavaScript', 'c#', 'Pascal', 'bash', 'shell', 'AutoIt'] y = ['windows', 'ubuntu', 'mac', 'android', 'vista', 'xp', 'win2000'] z = ['fara', 'rama', 'goga', 'google', 'zaza', 'faza', 'dura', 'puma'] import random a = random.choice(["x","y","z"]) value = [] if a == "x": a = random.sample(['python', 'c++', 'JavaScript', 'c#', 'Pascal', 'bash', 'shell', 'AutoIt'],4) value.append(x[0]) value.append(a) print("Выбран массив x") print("Возвращаю массив", value) elif a == "y": a = random.sample(['windows', 'ubuntu', 'mac', 'android', 'vista', 'xp', 'win2000'],4) value.append(y[0]) value.append(a) print("Выбран массив y") print("Возвращаю массив", value) elif a == "z": a = random.sample(['fara', 'rama', 'goga', 'google', 'zaza', 'faza', 'dura', 'puma'],4) value.append(z[0]) value.append(a) print("Выбран массив z") print("Возвращаю массив", value) a = input()
If you want to take lists from a separate file, I think you add it yourself, and in order not to repeat, you can use sets, but here from the fact that you gave no repetitions. (Although my code is very ugly, but if I understood the task correctly, it works ( 3.5), I would be grateful if someone writes beautifully)