Unit: Unit 4: Strings, Lists, and Tuples • Interactive Practice
Interactive Python programming tutorial and practice in your browser.
# Access and slice data from the coordinates tuple
gps_fix = (37.7749, -122.4194, 15.2, "GPS_LOCK_OK")
# 1. Access latitude (index 0) and status (index -1)
latitude = gps_fix[0]
status = gps_fix[-1]
# 2. Slice numerical coordinates (first 3 elements)
coords_only = gps_fix[:3]
print("Latitude:", latitude)
print("Status:", status)
print("Coordinates slice:", coords_only)