python - Why does return not return my Variable? -


my problem quite easy think...

i need go through excel list , want print out fields (to begin first 10 rows (so low_run = 0, high_run=10, , run=10 too).

now wanna next 10 need:

def get_input(high_run, low_run, run):     pressed_key = input('')      if pressed_key == "n":  # next page         set_high_run_np(high_run, run)         set_low_run_np(low_run, run)  def set_high_run_np(high_run, run):     if high_run != len(ldata):         high_run = high_run + run      return high_run  def set_low_run_np(low_run, run):     if low_run != len(ldata) - run:         low_run = low_run + run      return low_run 

the functions work , put out low_run = 10 , high_run = 20. won't return numbers can used... idea why?

thanks in advance , sorry grammar mistakes. no native speaker

cya!

i think miss return in first function

def get_input(high_run, low_run, run):     pressed_key = input('')      if pressed_key == "n":  # next page         return set_high_run_np(high_run, run), set_low_run_np(low_run, run)  def set_high_run_np(high_run, run):     if high_run != len(ldata):         high_run = high_run + run      return high_run  def set_low_run_np(low_run, run):     if low_run != len(ldata) - run:         low_run = low_run + run      return low_run 

i added return. chose return tuple of values in python done comma. there lot of other ways can choose return values, need return them.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -