0
Help with Text String Code
Here's the code: Here's the problem: "IndexError: list index out of range." Can anyone explain why this is happening? I feel like it's a minor detail I'm overlooking, but if it's big and ugly, don't hesitate to call me out. As always, thanks in advance. questions = [ "We don't serve strings around here. Are you a string?" "What is said on Father's Day in the forest?" "What makes the sound 'Sis! Boom! Bah?'" ] answers = [ "An exploding sheep." "No, I'm a frayed knot." "'Pop!' goes the weasel." ] q_a = ((0,1), (1,2), (2,0)) for q, a in q_a: print("Q:", questions[q]) print("A:", answers[a]) print()
2 ответов
+ 4
You just need to separate the elements of the lists with comma
+ 1
Thanks, Santa! I figured it was something minor I wasn't paying attention to.