The title explains the whole problem. The specific code I am struggling with is this block:
raceloop = True
while raceloop == True:
race = input("And what type of creature are you?\n")
race = race.lower()
if race == "elf" or "orc" or "human" or "dragonborn" or "halfling" or "tiefling" or "gnome" or "dwarf":
raceloop = False
elif race == "help":
print("Pick a race. The valid races are: Elf, Orc, Human, Dragonborn, Halfling, Tiefling, Gnome and Dwarf.")
continue
else:
print("That is not a valid race. Type \"Help\" for help.")
classloop = True
while classloop == True:
pclass = input("And what profession do you have?\n")
pclass = pclass.lower()
if pclass == "barbarian" or "bard" or "cleric" or "druid" or "fighter" or "monk" or "paladin" or "ranger" or "rogue" or "sorcerer" or "warlock" or "wizard":
classloop = False
elif pclass == "help":
print("Pick a class. The valid races are: Barbarian, Bard, Cleric, Druid, Fighter, Monk, Paladin, Ranger, Rogue, Sorcerer, Warlock and Wizard.")
continue
else:
print("That is not a valid class. Type \"Help\" for help.")
It accepts anything into the race and class fields.
Here is the entire code if it is needed, however I did make a few more files for functions and things.
import dice
import functions
playerinfo = functions.load()
playerinfo = playerinfo.split(",")
level = playerinfo[0]
if level == "":
print("It looks like you are just beginning, or your data has been corrupted.\nYou will now be started from the beginning.")
name = input("What is your name?\n")
raceloop = True
while raceloop == True:
race = input("And what type of creature are you?\n")
race = race.lower()
if race == "elf" or "orc" or "human" or "dragonborn" or "halfling" or "tiefling" or "gnome" or "dwarf":
raceloop = False
elif race == "help":
print("Pick a race. The valid races are: Elf, Orc, Human, Dragonborn, Halfling, Tiefling, Gnome and Dwarf.")
continue
else:
print("That is not a valid race. Type \"Help\" for help.")
classloop = True
while classloop == True:
pclass = input("And what profession do you have?\n")
pclass = pclass.lower()
if pclass == "barbarian" or "bard" or "cleric" or "druid" or "fighter" or "monk" or "paladin" or "ranger" or "rogue" or "sorcerer" or "warlock" or "wizard":
classloop = False
elif pclass == "help":
print("Pick a class. The valid races are: Barbarian, Bard, Cleric, Druid, Fighter, Monk, Paladin, Ranger, Rogue, Sorcerer, Warlock and Wizard.")
continue
else:
print("That is not a valid class. Type \"Help\" for help.")
else:
item1 = playerinfo[1]
item2 = playerinfo[2]
item3 = playerinfo[3]
pclass = playerinfo[4]
race = playerinfo[5]
name = playerinfo[6]
stage = playerinfo[7]
functions.save("1","Magic Sword","Potion","Magic Axe",pclass,race,name,"1")
functions.savestats("20","20","20","20","20","20","20")
I tested a bunch of words with it, all of the classes and races with varying capitalisation, and every single possible way to write the word help. These shouldn't matter because I make the string lowercase first, but I thought i'd try anyway.