Skip to main content

Posts

Showing posts with the label Programming

Python : indexing and slicing string

This example shows how to perform indexing and slicing on strings in python. Output str =  ABCDEFG Indexing A : First characters of string B : Second characters of string G : Last characters of string G : Last characters of string Slicing BC : First 2 characters of string BCDEFG : First to end of string ABCDEFG : Print the full string ABCDE : Print the string except last two characters