On remplace les if en elif pour avoir un résultat correct
Signed-off-by: Yohann D'ANELLO <ynerant@crans.org>
This commit is contained in:
parent
be7efbbfa7
commit
e8fc6d0816
12
main.py
12
main.py
|
@ -85,17 +85,17 @@ def calcul(left: int, right: int, res: int, operation='+'):
|
||||||
|
|
||||||
if operation in ['+', 'add', 'sum']:
|
if operation in ['+', 'add', 'sum']:
|
||||||
result = left + right
|
result = left + right
|
||||||
if operation in ['-', 'sub']:
|
elif operation in ['-', 'sub']:
|
||||||
result = left - right
|
result = left - right
|
||||||
if operation in ['*', 'mul', 'prod']:
|
elif operation in ['*', 'mul', 'prod']:
|
||||||
result = left * right
|
result = left * right
|
||||||
if operation in ['/', 'div']:
|
elif operation in ['/', 'div']:
|
||||||
result = left / right
|
result = left / right
|
||||||
if operation in ['&', 'and']:
|
elif operation in ['&', 'and']:
|
||||||
result = left & right
|
result = left & right
|
||||||
if operation in ['|', 'or']:
|
elif operation in ['|', 'or']:
|
||||||
result = left | right
|
result = left | right
|
||||||
if operation in ['^', 'xor']:
|
elif operation in ['^', 'xor']:
|
||||||
result = left ^ right
|
result = left ^ right
|
||||||
else:
|
else:
|
||||||
result = left % right
|
result = left % right
|
||||||
|
|
Loading…
Reference in New Issue