Skip to content

Instantly share code, notes, and snippets.

@enseitankad0
Created February 28, 2018 23:05
Show Gist options
  • Save enseitankad0/2bd10afa9d8c7be4611a7e4b705f0fa9 to your computer and use it in GitHub Desktop.
Save enseitankad0/2bd10afa9d8c7be4611a7e4b705f0fa9 to your computer and use it in GitHub Desktop.
# this is a test line in project 2
string1 = 'this as the same'
string2 = "as below"
print(string1 +" " + string2)
# print(string1)
print(string1[0]) # [t] his is as the same...
print(len(string1))
print(string1[-1]) # this is as the sam[e]...
# string[-2]='x' --> error, string is not mutable
print(string1[:5]) ## -> "this"
print(string1[10:]) ## -> "e same"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment