Think of as a sequence of case sensitive characters
can compare strings with ==, >, <, etc
len() : retrieve the length of the string in the parantheses
s = "abc"
print(len(s)) # 3
# s = "a b c"
# index : 0 1 2
# index : -3 -2 -1
s = "abc"
print(s[0]) # a
print(s[1]) # b
print(s[2]) # c
# print(s[3]) # trying to index out of bounds, error
print(s[-1]) # c
print(s[-2]) # b
print(s[-3]) # a
s = "abcdefgh"
print(s[3 : 6]) # "def"
print(s[3 : 6 :2]) # "df"
print(s[::]) # "abcdefgh"
print(s[::-1]) "hgfedcba"
print(s[4:1:-2]) "ec"
s = "hello"
# s[0] = 'y' # gives an error
s = 'y' + s[1:len(s)] # allowed, s bound to new object
print(s) # yello
s = "abcdefgh"
for index in range(len(s)) :
if s[index] == 'i' or s[index] == 'u' :
print("There is an i or u")
s = "abcdefgh"
for char in s :
if char == 'i' or char == 'u' :
print("There is an i or u")