File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ def ask_question(question):
5252 num_choices = len (correct_answers ),
5353 hint = question .get ("hint" ),
5454 )
55- if set (answers ) == set (correct_answers ):
55+ if correct := ( set (answers ) == set (correct_answers ) ):
5656 print ("⭐ Correct! ⭐" )
5757 else :
5858 is_or_are = " is" if len (correct_answers ) == 1 else "s are"
@@ -61,7 +61,7 @@ def ask_question(question):
6161 if "explanation" in question :
6262 print (f"\n EXPLANATION:\n { question ['explanation' ]} " )
6363
64- return 1 if set ( answers ) == set ( correct_answers ) else 0
64+ return 1 if correct else 0
6565
6666
6767def get_answers (question , alternatives , num_choices = 1 , hint = None ):
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ def ask_question(question):
4343 num_choices = len (correct_answers ),
4444 hint = question .get ("hint" ),
4545 )
46- if set (answers ) == set (correct_answers ):
46+ if correct := ( set (answers ) == set (correct_answers ) ):
4747 print ("⭐ Correct! ⭐" )
4848 else :
4949 is_or_are = " is" if len (correct_answers ) == 1 else "s are"
@@ -52,7 +52,7 @@ def ask_question(question):
5252 if "explanation" in question :
5353 print (f"\n EXPLANATION:\n { question ['explanation' ]} " )
5454
55- return 1 if set ( answers ) == set ( correct_answers ) else 0
55+ return 1 if correct else 0
5656
5757
5858def get_answers (question , alternatives , num_choices = 1 , hint = None ):
You can’t perform that action at this time.
0 commit comments