Answer:
Here's a Python code that should accomplish the task described in the directions:
Copy code
def exclamations(s):
s = list(s)
for i in range(len(s)):
if s[i] == 'i':
s[i] = '!'
return ''.join(s)
This code first converts the input string to a list so that individual characters can be accessed and modified. Then, it uses a for loop to go through each element of the list (in this case, each character of the original string). If the current character is a lowercase i, it is replaced with an exclamation point. Finally, the modified list is converted back to a string and returned.
The key is to know that the string type in python is immutable and you can't modify it by index like you do with list, you need to convert it into a list to be able to modify its elements.
It's also good to check if the string is converted to lowercase before the comparision, this way you could replace all the possible 'i' that could be in uppercase too.
Step-by-step explanation: