1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Svetllana [295]
4 years ago
7

Write a function called missing_letters that takes a string parameter and returns a new string with all the letters of the alpha

bet that are not in the argument string. The letters in the returned string should be in alphabetical order. Your implementation should use a histogram from the histogram function. It should also use the global variable alphabet. It should use this global variable directly, not through an argument or a local copy. It should loop over the letters in alphabet to determine which are missing from the input parameter.
Computers and Technology
1 answer:
kompoz [17]4 years ago
6 0

A string parameter and returns new string with all the letters of the alphabet that are not in the argument string. The letters in the returned string should be in alphabetical order. The implementation should uses a histogram from the histogram function

Explanation:

The below code is written in python :

alphabet = "abcdefghijklmnopqrstuvwxyz"

test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]

test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]

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):

   for v in histogram(s).values():

       if v > 1:

           return True

   return False

def test_dups_loop():

   for s in test_dups:

       print(s + ':', has_duplicates(s))

def missing_letters(s):

   r = list('abcdefghijklmnopqrstuvwxyz')

   s = s.lower()

   for c in s.lower():

       if c in r:

           r.remove(c)  # the first matching instance

   return ''.join(r)

def test_miss_loop():

   for s in test_miss:

       print(s + ':', missing_letters(s))

def main():

   test_dups_loop()

   test_miss_loop()

if __name__ == '__main__':

   main()

You might be interested in
What skill would be easiest to learn from a simulation video game?
garik1379 [7]

Answer:

D

Explanation:

the first three you would need hands-on practice to learn.

5 0
3 years ago
Read 2 more answers
Type the correct answer in the box. Spell all words correctly.
puteri [66]

Explanation:

Type the correct answer in the box. Spell all words correctly.

Ben has to type a long letter to his friend. What is the correct keying technique that Ben should use?

To prevent strain and key correctly, Ben should use his fingers gently over the keys with his wrist in a flat position.

7 0
3 years ago
What does Joann need to change in her outline?
Alona [7]
Where’s the outline?
6 0
3 years ago
Read 2 more answers
Effective nonverbal communication can cause tension.<br><br> True or False
agasfer [191]

Explanation:

When your nonverbal signals match up with the words you're saying, they increase trust, clarity, and rapport. When they don't, they can generate tension, mistrust, and confusion.

4 0
3 years ago
________ alignment is the default alignment for text in Word.
riadik2000 [5.3K]
The default alignment in Word is left-justified.
7 0
4 years ago
Other questions:
  • Jackson builders is constructing new homes in the Parkway subdivision.The company needs the logic for an application that ncalls
    13·1 answer
  • If I gain a rank and go under the points that the rank coust do I lose the rank
    8·2 answers
  • Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90; th
    8·2 answers
  • True/False: When a programmer creates an abstract data type, he or she can decide what values are acceptable for the data type,
    8·1 answer
  • Which of the following is a correctly named cell?<br> B8<br> BB-8<br> 8-B<br> 8B
    11·1 answer
  • A constructor can be overloaded with more than one function which has the same name but with what two different things
    7·1 answer
  • Is the address 7b invalid regarding cell references?
    8·1 answer
  • Drew is creating a game that stops the timer when the hourglass
    15·1 answer
  • A large computer software firm promised a client that it could deliver a new operating system on a tight deadline and put Keith
    10·2 answers
  • A thermogram taken outside a house shows high amounts of thermal energy around the windows but not around the roof. which conclu
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!