Basic String Operations in Python

#Basic_String_Operations # <<—this is a comment #can use double or single quotes” astring = “Hello world!” astring2 = ‘Hello world!’ #enclose single quotes inside double quotes print(“single quotes are ‘ ‘”) #print the length of a string print(len(astring)) #print index of string w/ first occurrence of the letter #”o” print(astring.index(“o”)) #count the number of “ls” …

Design a site like this with WordPress.com
Get started