我正在学习python,我只是想知道我是否有办法编写一个类似的代码:
def f(x): if x>1: return(x) else: # don't return anything
我问的是代码的其他部分.如果x<=1返回None是不可接受的,我不需要返回任何东西.
x<=1
None
python
python ×1