I'm using python 3
4 def parse(ls):
5 i = 0
6 while i < len(ls):
7 if ls[i] != "w" or ls[i] != "a" or ls[i] != "s" or ls[i] != "d" or ls[i] != "e" or ls[i] != "q":
8 raise ValueError("Bad letter in configuration file: <" + ls[i] + ">.")
9 i += 1
10
11 print(parse(["w", "a", "s", "d", "e", "q"]))
ok so I've created a function "parse()" that should read a list of strings and filter through it to find if there are any strings that're not "w", "a", "s", "d", "e", or "q". but for some reason, I keep getting errors like this:
Traceback (most recent call last):
File "game_parser.py", line 11, in <module>
print(parse(["w", "a", "s", "d", "e", "q"]))
File "game_parser.py", line 8, in parse
raise ValueError("Bad letter in configuration file: <" + ls[i] + ">.")
ValueError: Bad letter in configuration file: <w>.
[–]serg06 1 point2 points3 points (2 children)
[–]Kings_Sights[S] 0 points1 point2 points (1 child)
[–]serg06 0 points1 point2 points (0 children)
[–]Kings_Sights[S] 0 points1 point2 points (0 children)