Factorisation de tests
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
ecec88e230
commit
d8c6b6e6bf
32
main.py
32
main.py
|
@ -59,37 +59,19 @@ def calcul(left: int, right: int, res: int, operation='+'):
|
|||
Vérifie si left operation b == c, où a, b et c sont des entiers.
|
||||
L'opération peut être +, -, *, /, &, |, ^, % ou l'un de ses alias anglais.
|
||||
"""
|
||||
if operation == '+':
|
||||
if operation in ['+', 'add', 'sum']:
|
||||
result = left + right
|
||||
if operation == 'sum':
|
||||
result = left + right
|
||||
if operation == 'add':
|
||||
result = left + right
|
||||
if operation == '-':
|
||||
if operation in ['-', 'sub']:
|
||||
result = left - right
|
||||
if operation == 'sub':
|
||||
result = left - right
|
||||
if operation == '*':
|
||||
if operation in ['*', 'mul', 'prod']:
|
||||
result = left * right
|
||||
if operation == 'mul':
|
||||
result = left * right
|
||||
if operation == 'prod':
|
||||
result = left * right
|
||||
if operation == '/':
|
||||
if operation in ['/', 'div']:
|
||||
result = left / right
|
||||
if operation == 'div':
|
||||
result = left / right
|
||||
if operation == '&':
|
||||
if operation in ['&', 'and']:
|
||||
result = left & right
|
||||
if operation == 'and':
|
||||
result = left & right
|
||||
if operation == '|':
|
||||
if operation in ['|', 'or']:
|
||||
result = left | right
|
||||
if operation == 'or':
|
||||
result = left | right
|
||||
if operation == '^':
|
||||
result = left ^ right
|
||||
if operation == 'xor':
|
||||
if operation in ['^', 'xor']:
|
||||
result = left ^ right
|
||||
else:
|
||||
result = left % right
|
||||
|
|
Loading…
Reference in New Issue