Вы можете использовать упаковщик, который не вернется, пока ответ не был виден раньше. Например:
def no_dupe_response_input(prompt):
try:
seen = no_dupe_response_input.seen
except AttributeError:
seen = no_dupe_response_input.seen = set()
while True:
response = input(prompt)
if response in seen:
print(f'You already responded "{response}". Please respond something else.')
else:
seen.add(response)
return response
name = no_dupe_response_input('Enter Your Name: ')
friend_name = no_dupe_response_input('Enter Your Friend\'s Name? ')
print(f'You are {name} and your friend is {friend_name}!')
Результат:
Enter Your Name: foo
Enter Your Friend's Name? foo
You already responded "foo". Please respond something else.
Enter Your Friend's Name? foo
You already responded "foo". Please respond something else.
Enter Your Friend's Name? bar
You are foo and your friend is bar!