stop a function from continuing when a condition is met python

# use return e.g
def test_function(input):
  if input == 5:
    return 
  else:
    print(input)
    
#f you run 
test_function(5)
#the function will simply just end

  

Here is what the above code is Doing:
1. Defining a function called test_function that takes an input.
2. If the input is equal to 5, the function will return.
3. If the input is not equal to 5, the function will print the input.
4. Calling the function with an input of 5.
5. Calling the function with an input of 6.