Home > database >  Python for guidance
Python for guidance

Time:09-24

Self. Odometer_reading +=miles can change
The mileage +=miles
Why can't change or
Thank you

CodePudding user response:

The parameters in the mileage is update_odometer function, scope only within the function
Self. Odometer_reading +=miles this function in increment_odometer function, can't access the mileage in the function variables, so can't change
Self odometer_reading is equivalent to a bridge, as the class variables, can access in a function within the class
Prev:C + +
Next:ahhh
  • Related