is it possible to not return anything from a function in python?

前端 未结 5 635
夕颜
夕颜 2020-12-01 16:09

with a simple filter that test input against a range 0-100.

def foo(foo_input):
    if 0 <= foo_input <= 100:
        return f_input

5条回答
  •  旧时难觅i
    2020-12-01 16:35

    If a return statement is not reached, the function returns None.

    def set_x():
        x = 2
    

提交回复
热议问题