- Code: Select all
finished = False
while not finished:
name=raw_input("Please enter your name: ")
print("Hi " + name + "! and welcome to the virtual game of car cricket")
name2=raw_input("Please enter the second players name: ")
if (name2 == name):
print("Players cannot have the same name")
finished = True
print("Hi " + name2 + "! and welcome to the virtual game of car cricket")
after entering the same name it doesn't end the script, it just continues as usual (after printing players cannot have the same name).
all I'm trying to do is have it so if the names are the same the program stops instead of continuing, If anyone can help me it'd be greatly appreciated, cheers heaps.