←
Strings
‹
Example 4 of 5
›
Reset
Run code
Python · edit the code
Ctrl
+
Enter
runs it
Code
vehicle = "HR12AB3456" state = vehicle[:2] district = vehicle[2:4] number = vehicle[-4:] print(state, district, number) print(vehicle[::2]) print(vehicle[::-1])
Output · Python 3.14 in your browser