

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Programming Assignment 7 Alphabet = “abcdefghijklmnopqrstuvwxyz” Test_dups = [“zzz”, “dog”, “bookkeeper”, “subdermatoglyphic”, “subdermatoglyphics”] Test_miss = [“zzz”, “subdermatoglyphic”, “the quick brown fox jumps over the lazy dog”]
Massachusetts: Green Tree Press. Def histogram(s): D = dict() For c in s: If c not in d: D[c] = 1 Else: D[c] += 1 Return d Def has_duplicates(s):
Return len(histogram(s)) != len(s)
Def missing_letters(s): H = histogram(s) Rv = ‘’
For c in alphabet: If c not in h: Rv = rv + c Return rv
For s in test_miss: Miss = missing_letters(s) If miss: Print(f”{s} is missing letters {miss}.”) Else: Print(f”{s} uses all the letters.”)