Skip to content

Instantly share code, notes, and snippets.

@rashedulemon
Last active June 24, 2018 17:04
Show Gist options
  • Select an option

  • Save rashedulemon/2c12163120e4a5ed0b051eb2e3ce502e to your computer and use it in GitHub Desktop.

Select an option

Save rashedulemon/2c12163120e4a5ed0b051eb2e3ce502e to your computer and use it in GitHub Desktop.
This is a program which is show how slice orerator([] and [:]) work.
S1 = "Hello Python"
print(S1) # Prints complete string
print(S1[0]) # Prints first character of the string
print(S1[2:5]) # Prints character starting from 3rd t 5th
print(S1[2:]) # Prints string starting from 3rd character
print(S1 * 2) # Prints string two times
print(S1 + "Thanks") # Prints concatenated string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment