What's the difference between a class and an object?
- A.They are two words for the same thing
- B.A class is the blueprint; an object is a specific thing built from it
- C.A class is smaller than an object
- D.An object is only for sensors
Answer Why?
When does the __init__ method run?
- A.When you import the file
- B.When you create an object with LineSensor()
- C.Every time you call any method
- D.At the end of the program
Answer Why?
You have `sensor = LineSensor()`. How do you call its get_error method?
- A.sensor.get_error(self)
- B.sensor.get_error()
- C.get_error(sensor)
- D.LineSensor.get_error()
Answer Why?
Write is_on_line() to return True when AT LEAST ONE sensor is on the line. Which body is correct?
- A.return self.get_left() > self.threshold or self.get_right() > self.threshold
- B.return self.get_left() > self.threshold and self.get_right() > self.threshold
- C.return get_left() or get_right()
- D.return self.threshold
Answer Why?