1.

a.

Iterate over each character in the sequence from the beginning to end, replacing each A, T, G, and C with its T, A, C, and G, respectively.

b.

No!

c.

```def complement(sequence):
""" (str) -> str

Return the complement of sequence.

>>> complement('AATTGCCGT')
'TTAACGGCA'
"""

complement_dict = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
sequence_complement = ''

for char in sequence:
sequence_complement = sequence_complement + complement_dict[char]

return sequence_complement
```

2.

a.

```
index = 0
smallest = L[0]

for i in range(1, len(L)):
if L[i] < smallest:
index = i
smallest = L[i]
```

b.

```def min_index(L):
""" (list) -> (object, int)

Return a tuple containing the smallest item from L and its index.

>>> min_index([4, 3, 2, 4, 3, 6, 1, 5])
(1, 6)
"""

index = 0
smallest = L[0]

for i in range(1, len(L)):
if L[i] < smallest:
index = i
smallest = L[i]

return (smallest, index)
```

c.

```def min_or_max_index(L, flag):
""" (list, bool) -> tuple of (object, int)

Return the minimum or maximum item and its index from L, depending on
whether flag is True or False.

>>> min_or_max_index([4, 3, 2, 4, 3, 6, 1, 5], True)
(1, 6)
>>> min_or_max_index([4, 3, 2, 4, 3, 6, 1, 5], False)
(6, 5)
"""

index = 0
current_value = L[0]

if flag:
for i in range(1, len(L)):
if L[i] < current_value:
index = i
current_value = L[i]
else:
for i in range(1, len(L)):
if L[i] > current_value:
index = i
current_value = L[i]

return (current_value, index)
```