import itertools
people = ['A', 'B', 'C', 'D', 'E'] # Список осіб
seats = ['Driver', 'Front Passenger', 'Middle Passenger', 'Back Left Passenger', 'Back Right Passenger'] # Список місць
combinations = list(itertools.permutations(people, len(seats)))
for combination in combinations:
for i in range(len(combination)):
print(f"{combination[i]}: {seats[i]}")
print()
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
import itertools
people = ['A', 'B', 'C', 'D', 'E'] # Список осіб
seats = ['Driver', 'Front Passenger', 'Middle Passenger', 'Back Left Passenger', 'Back Right Passenger'] # Список місць
combinations = list(itertools.permutations(people, len(seats)))
for combination in combinations:
for i in range(len(combination)):
print(f"{combination[i]}: {seats[i]}")
print()