multiple choice question with no wrong answers but different points per each answer









up vote
-1
down vote

favorite












questions = ["What is 1 + 1",
"Who is the 45th president of the United States?",
"True or False... The Toronto Maple Leafs have won 13 Stanley Cups?",
"What was the last year the Toronto Maple Leafs won the Stanley Cup?",
"True or False... The current Prime Minister of Canada is Pierre Elliot Tredeau?"]
answer_choices = ["a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)The boyfriendnb)The girlfriendn:",

"a)Yesnb)Non:"]
correct_choices = ["a":1, "b":8,
"a":8, "b":3,
"a":8, "b":1,
"a":2, "b":7,
"a":4, "b":6,]
answers = ["good answer", "bad answer",
"bad answer", "good answer",
"bad answer", "good answer",
"good answer", "bad answer",
"good answer", "bad answer"]


def quiz():
score = 0
for question, choices, correct_choice, answer in zip(questions, answer_choices, correct_choices, answers):
print(question)
user_answer = input(choices).lower()
if user_answer in correct_choice:
print("Correct")
score += 1
else:
print("Incorrect", answer)
print(score, "out of", len(questions), "that is", float(score / len(questions)) * 100, "%")

if __name__ == "__main__":
quiz()




I created a list of my questions, a list of the answer choices, a list of the correct choices which is a dictionary list (shows the answer choice and the points assigned to that answer choice), and finally a list of answers which says if it is a good answer or a bad answer. If the point (which ranges from 1-10)assigned to an answer is 5 or less, it is a good answer if the point assigned to answer is 6 or greater, it is a bad answer.



The big issue is under my correct choices list, it won't let me pull the values of the answers. I keep getting an attributeError.










share|improve this question























  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
    – stovfl
    Nov 11 at 12:23















up vote
-1
down vote

favorite












questions = ["What is 1 + 1",
"Who is the 45th president of the United States?",
"True or False... The Toronto Maple Leafs have won 13 Stanley Cups?",
"What was the last year the Toronto Maple Leafs won the Stanley Cup?",
"True or False... The current Prime Minister of Canada is Pierre Elliot Tredeau?"]
answer_choices = ["a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)The boyfriendnb)The girlfriendn:",

"a)Yesnb)Non:"]
correct_choices = ["a":1, "b":8,
"a":8, "b":3,
"a":8, "b":1,
"a":2, "b":7,
"a":4, "b":6,]
answers = ["good answer", "bad answer",
"bad answer", "good answer",
"bad answer", "good answer",
"good answer", "bad answer",
"good answer", "bad answer"]


def quiz():
score = 0
for question, choices, correct_choice, answer in zip(questions, answer_choices, correct_choices, answers):
print(question)
user_answer = input(choices).lower()
if user_answer in correct_choice:
print("Correct")
score += 1
else:
print("Incorrect", answer)
print(score, "out of", len(questions), "that is", float(score / len(questions)) * 100, "%")

if __name__ == "__main__":
quiz()




I created a list of my questions, a list of the answer choices, a list of the correct choices which is a dictionary list (shows the answer choice and the points assigned to that answer choice), and finally a list of answers which says if it is a good answer or a bad answer. If the point (which ranges from 1-10)assigned to an answer is 5 or less, it is a good answer if the point assigned to answer is 6 or greater, it is a bad answer.



The big issue is under my correct choices list, it won't let me pull the values of the answers. I keep getting an attributeError.










share|improve this question























  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
    – stovfl
    Nov 11 at 12:23













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











questions = ["What is 1 + 1",
"Who is the 45th president of the United States?",
"True or False... The Toronto Maple Leafs have won 13 Stanley Cups?",
"What was the last year the Toronto Maple Leafs won the Stanley Cup?",
"True or False... The current Prime Minister of Canada is Pierre Elliot Tredeau?"]
answer_choices = ["a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)The boyfriendnb)The girlfriendn:",

"a)Yesnb)Non:"]
correct_choices = ["a":1, "b":8,
"a":8, "b":3,
"a":8, "b":1,
"a":2, "b":7,
"a":4, "b":6,]
answers = ["good answer", "bad answer",
"bad answer", "good answer",
"bad answer", "good answer",
"good answer", "bad answer",
"good answer", "bad answer"]


def quiz():
score = 0
for question, choices, correct_choice, answer in zip(questions, answer_choices, correct_choices, answers):
print(question)
user_answer = input(choices).lower()
if user_answer in correct_choice:
print("Correct")
score += 1
else:
print("Incorrect", answer)
print(score, "out of", len(questions), "that is", float(score / len(questions)) * 100, "%")

if __name__ == "__main__":
quiz()




I created a list of my questions, a list of the answer choices, a list of the correct choices which is a dictionary list (shows the answer choice and the points assigned to that answer choice), and finally a list of answers which says if it is a good answer or a bad answer. If the point (which ranges from 1-10)assigned to an answer is 5 or less, it is a good answer if the point assigned to answer is 6 or greater, it is a bad answer.



The big issue is under my correct choices list, it won't let me pull the values of the answers. I keep getting an attributeError.










share|improve this question















questions = ["What is 1 + 1",
"Who is the 45th president of the United States?",
"True or False... The Toronto Maple Leafs have won 13 Stanley Cups?",
"What was the last year the Toronto Maple Leafs won the Stanley Cup?",
"True or False... The current Prime Minister of Canada is Pierre Elliot Tredeau?"]
answer_choices = ["a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)Yesnb)Non:",

"a)The boyfriendnb)The girlfriendn:",

"a)Yesnb)Non:"]
correct_choices = ["a":1, "b":8,
"a":8, "b":3,
"a":8, "b":1,
"a":2, "b":7,
"a":4, "b":6,]
answers = ["good answer", "bad answer",
"bad answer", "good answer",
"bad answer", "good answer",
"good answer", "bad answer",
"good answer", "bad answer"]


def quiz():
score = 0
for question, choices, correct_choice, answer in zip(questions, answer_choices, correct_choices, answers):
print(question)
user_answer = input(choices).lower()
if user_answer in correct_choice:
print("Correct")
score += 1
else:
print("Incorrect", answer)
print(score, "out of", len(questions), "that is", float(score / len(questions)) * 100, "%")

if __name__ == "__main__":
quiz()




I created a list of my questions, a list of the answer choices, a list of the correct choices which is a dictionary list (shows the answer choice and the points assigned to that answer choice), and finally a list of answers which says if it is a good answer or a bad answer. If the point (which ranges from 1-10)assigned to an answer is 5 or less, it is a good answer if the point assigned to answer is 6 or greater, it is a bad answer.



The big issue is under my correct choices list, it won't let me pull the values of the answers. I keep getting an attributeError.







python python-3.x list class






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 23:59









eyllanesc

69.3k93052




69.3k93052










asked Nov 11 at 4:25









Paul Mburu

41




41











  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
    – stovfl
    Nov 11 at 12:23

















  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
    – stovfl
    Nov 11 at 12:23
















Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
– stovfl
Nov 11 at 12:23





Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question.
– stovfl
Nov 11 at 12:23


















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245826%2fmultiple-choice-question-with-no-wrong-answers-but-different-points-per-each-ans%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245826%2fmultiple-choice-question-with-no-wrong-answers-but-different-points-per-each-ans%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3