File tree Expand file tree Collapse file tree 1 file changed +11
-11
lines changed
Expand file tree Collapse file tree 1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -74,20 +74,20 @@ def _math_operation(question: list[str]) -> int:
7474 :rtype: int
7575 """
7676 math_operator : str = question [1 ]
77- result : int = 0
7877
7978 if math_operator == "+" :
80- result = int (question [0 ]) + int (question [- 1 ])
81- elif math_operator == "-" :
82- result = int (question [0 ]) - int (question [- 1 ])
83- elif math_operator == "/" :
84- result = int (question [0 ]) // int (question [- 1 ])
85- elif math_operator == "*" :
86- result = int (question [0 ]) * int (question [- 1 ])
87- else :
88- raise ValueError ("syntax error" )
79+ return int (question [0 ]) + int (question [- 1 ])
80+
81+ if math_operator == "-" :
82+ return int (question [0 ]) - int (question [- 1 ])
83+
84+ if math_operator == "/" :
85+ return int (question [0 ]) // int (question [- 1 ])
86+
87+ if math_operator == "*" :
88+ return int (question [0 ]) * int (question [- 1 ])
8989
90- return result
90+ raise ValueError ( "syntax error" )
9191
9292
9393def _validate_evaluation_pattern (val : list [str ]) -> None :
You can’t perform that action at this time.
0 commit comments