print("--String--") # Note: All string methods return new values. They do not change the original string.
text="a" # or 'a'
para=""" The String is my fav """ #or
""" para=''' The String is my fav ''' """
# concentation str="Hello" print(str + " "+"World!") #access character in String print(str[0]) #index start with 0 #Slicing print(str[0:3])#start,stop,step #negative print(str[-1])#return last character
# Loop through in string for i in str: print(i)
#check the character in string print('p' in str)
#check the character not in string print('h' not in str)
#length in string print(len(str))
print(chr(97))
print(ord('a'))# return ascii number
# print(ascii('o'))
Get Datawhiz’s stories in your inbox
Join Medium for free to get updates from this writer.
#output --String-- Hello World! H Hel o H e l l o False True 5 a 97