defFun (): forXinchRange (4): Print(x) fun ()#Call the fun function, print all results-(Result: 0,1,2,3)defFun (): forXinchRange (4): returnXfun ()#Call the fun function, return the value returned in the function, the caller cannot see-(see no result with the naked eye)defFun (): forXinchRange (4): returnxPrint(Fun ())#Input Function Fun,for The first x value is returned by return, and the final break loop-(Result: 0)defFun (): forXinchRange (4): Print(x) BreakFun ()#Call the fun function, print the result for the first output of print, Break end loop-(Result: 0)defFun (): forXinchRange (4): Print(x) Break return1Print(Fun ())#The output fun function, after the break end loop, returns can also return a value in the function-(Result: 0,1)
#break终止for循环 return and input collocation with print call, separate call no result
Python basic Syntax Break,return,print