Java Function N Example Code Python