def explode(s):
  l = []
  for char in s:
    l.append(char)
  return l

assert explode("Hello") == ["H", "e", "l", "l", "o"]

def explodeWithOutput(s):
  l = []
  print("Input string: " + s)
  print("Initial value: " + str(l))
  
  for c in s:
    print("---> BEGIN ITERATION <---")
    print("For this iteration c is " + c)
    l.append(c)
    print("At the end of the iteration l is " + str(l))
    
  print("After the for loop l is " + str(l))
  return l

#assert explodeWithOutput("Hello") == ["H", "e", "l", "l", "o"]

# Solution using two for loops one after another
def explodeMore1(strings):
  # First concatenate all the strings in the input list
  # into one big string
  bigString = ""
  for s in strings:
    bigString = bigString + s;
  
  l = []
  for c in bigString:
    l.append(c)

  return l

assert explodeMore1(["Hi","Bye"]) == ["H","i","B","y","e"], "Results not expected: " + str(explodeMore1(["Hi","Bye"]))

# Solution using a nested for loop
def explodeMore2(strings):
  l = []
  for s in strings:
    for c in s:
      l.append(c)

  return l

assert explodeMore2(["Hi","Bye"]) == ["H","i","B","y","e"], "Results not expected: " + str(explodeMore2(["Hi","Bye"]))

def dnaCount(string, base):
  count = 0
  for b in string:
    if b == base:
      count = count + 1
  return count

assert dnaCount("ACAGCCTAAG", "A") == 4
assert dnaCount("ACAGCCTAAG", "G") == 2

def dnaSimilarity(s1, s2):
  count = 0
  for i in range(0, len(s1)):
    if s1[i] == s2[i]:
      count = count + 1
  
  return count / len(s1)

assert dnaSimilarity("ACAGCCTAAG", "ACAGCCTAAG") == 1.0
assert dnaSimilarity("ACAGCCTAAG", "ACAGCGGTCC") == 0.5

def dnaFrequency(string):
  bases = "ACGT"
  l = []
  for b in bases:
    l.append([b, dnaCount(string, b)])
  return l

assert dnaFrequency("ACAGCCTAAG") == [["A", 4],["C", 3], ["G",2],["T",1]]
assert dnaFrequency("TCAGCCTAAG") == [["A", 3],["C", 3], ["G",2],["T",2]]