Spaces:
Runtime error
Runtime error
zjowowen
commited on
Commit
•
4200f57
1
Parent(s):
625a380
fix(zjow): fix checker in level4.py (#8)
Browse files
llmriddles/questions/level4.py
CHANGED
@@ -82,12 +82,12 @@ def _checker_3(question_text: str, user_text: str, answer_text: str, lang: str):
|
|
82 |
_ = question_text, lang
|
83 |
answer_text = answer_text.strip()
|
84 |
user_text = user_text.strip()
|
85 |
-
if not check_if_is_number(
|
86 |
return False, "问题应该是一个正整数" if lang == 'cn' else 'Question should be a positive integer.'
|
87 |
-
elif int(
|
88 |
return False, "问题应该是一个大于1的正整数" if lang == 'cn' else 'Question should be a positive integer greater than 1.'
|
89 |
-
elif int(
|
90 |
-
|
91 |
return False, "回答中应该包含一个与问题相差1的数字" if lang == 'cn' else 'Answer should contain a number that is exactly 1 different from the question.'
|
92 |
else:
|
93 |
return True, None
|
|
|
82 |
_ = question_text, lang
|
83 |
answer_text = answer_text.strip()
|
84 |
user_text = user_text.strip()
|
85 |
+
if not check_if_is_number(user_text):
|
86 |
return False, "问题应该是一个正整数" if lang == 'cn' else 'Question should be a positive integer.'
|
87 |
+
elif int(user_text) == 1:
|
88 |
return False, "问题应该是一个大于1的正整数" if lang == 'cn' else 'Question should be a positive integer greater than 1.'
|
89 |
+
elif int(user_text) - 1 not in get_all_numbers_in_a_sentence(answer_text) or int(
|
90 |
+
user_text) + 1 not in get_all_numbers_in_a_sentence(answer_text):
|
91 |
return False, "回答中应该包含一个与问题相差1的数字" if lang == 'cn' else 'Answer should contain a number that is exactly 1 different from the question.'
|
92 |
else:
|
93 |
return True, None
|