Results for “global”

2 results

  1. Challenge

    Launch counter crash

    record_launch() adds 1 to a global counter and stops with an UnboundLocalError. Predict it, find out why Python treats the name as local, fix it by passing the count in and returning the new one, then…

    Fix the code Medium 3 stages functions scope UnboundLocalError global
  2. Challenge

    Shadowed fuel

    …the function, creating a local variable and leaving the global fuel unchanged. Predict the last line, compare both values, fix it by returning the total, then write a function that uses only its…

    Fix the code Medium 3 stages functions scope local variables global variables