print("EXAMPLE FOR: len(various), slice") #len () is pretty self explainatory, works on variables and containers like a list Str_longWord = "antidisestablishmentarianism" Lst_shortList = ["cat",47,2.414,"dog",0] print("the long word is: ",Str_longWord,"its length is",len(Str_longWord)) print("the short list is: ",Lst_shortList,"its length is",len(Lst_shortList)) #slice picks out a part of a word and is constructed by your selection in brackets #Example: pick out letters 7 (start with 0) to the length of a long word minus 8 print ("letters 7 through "+str(len(Str_longWord))+ " -8 are: ") print(Str_longWord[7: len(Str_longWord)-8]) # if you want the start and use all the rest just end the [slice] at the ":" print("finding [7:]") print (Str_longWord[7:]) #the slice syntax is [start : [stop] [: step]] - stop and step are optional Str_secretCode="pdyatdhdoyn" print("The secret code phrase is: ", Str_secretCode) print("Secret word if you start with the second letter - second letter is letter 1") print(Str_secretCode[1:len(Str_secretCode):2]) print("Secret word if you start with the first letter - first letter is letter 0") print(Str_secretCode[0:len(Str_secretCode):2])