"""
Learning Goals:
 - Index and slice into strings to break them up into parts
 - Use for loops to loop over strings by index
 - Use string operations and methods to solve problems
"""

s = "STELLA"
c = s[2] # "E"
print(c)

###

s = "abcde"
print(s[2:len(s):1])   # prints "cde"
print(s[0:len(s)-1:1]) # prints "abcd"
print(s[0:len(s):2])   # prints "ace"

###

s = "Hello World"
for i in range(len(s)):
    print(i, s[i])

###

s = "Wow!! This!! Is very fun!"
count = 0
for i in range(len(s)):
    if s[i] == "!":
        count = count + 1
print(count)

###

def isPalindrome(s):
    for i in range(len(s)):
        c1 = s[i]
        c2 = s[len(s) - 1 - i]
        if c1 != c2:
            return False
    return True

###

def formalName(s):
    return s[0].isupper() and s[1:].islower()

###

def makePassword(phrase):
    phrase2 = phrase.lower()
    phrase3 = phrase2.replace("a", "@").replace("o", "0")
    return phrase3

###

def getFirstName(fullName):
    spaceIndex = fullName.find(" ")
    first = fullName[:spaceIndex]
    return first