I have a function that takes a string argument then it is converted to a histogram dictionary. What the function is supposed to do is compare each key which is a character to a global variable containing all the letters from the alphabet. Return a new string with the alphabet minus the characters in the dictionary. how would I accomplish this in a function using a for loop and not using counter?
alphabet = 'abcdefghi'
def histogram(s):
     d = dict()
     for c in s:
          if c not in d:
               d[c] = 1
          else:
               d[c] += 1
     return d
def missing_characters(s):
    h = histogram(s)
    global alphabet
    for c in h.keys():
        if c in alphabet:
            del h[c]
missing_characters("abc")
I get an error stating that the dictionary has changed. What I need to do is remove the given string characters from the dictionary histogram and return a new string with all the letters in order except for the ones in the string passed as an argument.
thanks in advance.
 
    