Ask coding questions

← Back to all posts
Why is the program giving a key error?
catspython (27)

So it's this quiz again. I changed it so it uses the split function to extract the list from the string instead of putting a list in the db, that just doesn't work, though it may be the same problem as this...

So this code should, and has in the past (with different db keys).
So I use this code:

results = []
clear()
for question in questions:
  hi = db[question].split(",")
  print(hi[0])
  results.append(input("[1]"+hi[1]+"\nor\n"+"[2]"+hi[2]+"?\n>"))

(questions = db.keys() is in the program's top.)
With this code it just gives a key error for NO REASON AT ALL!
So... How can I get this to work?

@EpicGamer007 run the program to get the error, and it's stuff like
key: windows or mac
data:windows or mac,windows,mac

Comments
hotnewtop
IcynDevz (765)

When I run the repl, I don't see any error.

catspython (27)

@IcynHackz does it show questions?

IcynDevz (765)

well no @catspython, after I press enter the program ends.

catspython (27)

@IcynHackz and the data base is not accessible to people that are not the owner........ very annoying.....

IcynDevz (765)

yeah. @catspython. Send some feedback over here

RYANTADIPARTHI (6011)

everything seems to be working.

catspython (27)

@RYANTADIPARTHI Do you see questions? It doesn't work if you don't.

EpicGamer007 (1644)

can you please tell us the error you are getting? And if possible, can you please tell us what you have in repldb atm?