I am trying to code a match fixture app which takes a certain number of teams and puts them vs each other without repeating the same team twice successively i.e having the same team play twice in two days e.g if the teams listed are "a", "b", "c", "d" and "e" and they are to play four matches this code prints results like
a vs b
c vs d
c vs e
but I am trying to prevent it from repeating the same element twice in a row i.e
c vs d
c vs e
but rather
a vs b
c vs d
e vs a
the code is below, what changes do I need to make
import random
number_of_teams = int(input('How many teams? : '))
other_number = number_of_teams + 1
teams = []
number_of_matches = int(input("How many matches are to be played?: "))
real_number_of_matches = number_of_matches + 1
for i in range(1, other_number):
team_name = input("Input team name: ")
teams.append (team_name)
print('The teams participating are', teams)
for i in range(1, real_number_of_matches):
first_team = random.choice(teams)
second_team = random.choice(teams)
if first_team != second_team:
print(f'{first_team} vs {second_team}')```