任务要求 评论①
Fill in the blanks in the following function for adding a to the absolute value ofb,without calling abs. You may not modify any of the provided code other than the two blanks.
1. from operator import add,sub
2.
3. def a_plus_abs_b(a,b):
4. """Return a+abs(b),but with
:
return add(a, sub(b, 0)) if b < 0 else add(a, b)
两个空如下,望采纳!!
if b < 0:
f = sub
else:
f = add
return f(a, b)
如果你还有其他题目需要解答,请参考:https://blog.csdn.net/weixin_43534205/article/details/89410703