A Python snippet utilizing the LEGO EV3 ultrasonic sensor, the LEGO EV3 Brick and Pybricks. Pybricks is the LEGO recommended method of using the LEGO EV3 Brick with Python. See the official Python for EV3 LEGO page for more details.
This example uses the EV3 ultrasonic sensor to measure the distance of an object in front of the sensor. This example will move both motors forward until something is blocking it's path.