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.
python python-3.x list class
add a comment |
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.
python python-3.x list class
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
add a comment |
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.
python python-3.x list class
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
python python-3.x list class
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
add a comment |
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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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