Space Python Loading Python…

Local and Global Variables

 
0:00 / 0:00

Challenge

Practise what this example shows: fix or write code until the tests pass.

Shadowed fuel

Fix the codeMedium 3 stages

refuel() assigns to fuel_kg inside 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 parameters.

Start the challenge

Discussion

Stuck on this example or want to go further? Ask here, or see what others asked.

Log in to ask and reply.

script.py
PythonLn 1, Col 1Spaces: 4
Loading the Python environment…

Separate arguments with commas. They're passed on every Run as sys.argv[1:].