# Imports
import re
# Variables
contestants = []
def run(string):
incorrectSymbols = re.compile('[@_!#$%^&*()<>?/\|}{~:]')
if (incorrectSymbols.search(string) == None):
return "yes"
else:
return "no"
def bootUp():
print(""">>> Hello judges!
>>> Today you will be viewing 6 contestants!
>>> To continue please enter all contestants names!""")
contestantNames()
def contestantNames():
for i in range(0, 6):
while True:
x = input(">>> Contestant number " + str(i) + " name: ")
if run(x) == "yes":
break
elif run(x) == "no":
print(">>> No symbols allowed!")
elif x=="": # Here is what im confused about.
print(">>> You can't leave it blank!")
else:
print(">>> Error in run function.")
contestants.append(x)
print(contestants)
bootUp()
After reading up on this problem I found multiple accounts saying to do this simply use (variable)="" . However, this does not work for me, any other ideas?
My code is an attempt for a dance project where contestants all take turns and each judge scores each contestant. A tournament to be put simply. This part of the code would be the beginning where I obtain the contestant's names and i need to make sure they have no symbols or left blank.