# PracProg2alg

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)

## Page History

- V10: Jennifer Campbell [over 2 years ago]
- V9: Jennifer Campbell [over 2 years ago]
- V8: Jennifer Campbell [over 2 years ago]
- V7: Jennifer Campbell [over 2 years ago]
- V6: Jennifer Campbell [over 2 years ago]
- V5: Jennifer Campbell [over 2 years ago]
- V3: Jennifer Campbell [over 2 years ago]
- V4: System [over 2 years ago]
- V2: Jennifer Campbell [over 2 years ago]
- V1: Shawn Beard [over 2 years ago]