Question: I have been working on this for too long. It should be simple and I've ran through many different combinations, however, I keep getting the code wrong and have no idea why. It works fine when I have manual input, but when I submit there is an error.

question prompt:
Write a program that keeps a dictionary of names and their corresponding phone numbers.

Repeatedly ask the user for a name. Then, do one of the following three things, depending on what they enter:

If they enter nothing, exit the program.
If they enter a name that exists as a key in your dictionary, simply print the corresponding phone number.
If they enter a name that is NOT in your dictionary as a key, ask the user for a phone number, and then put the name and phone number in your dictionary.
Print out the final dictionary.

my code:

```
phoneBook = {}
name = input("Please enter a name(or press enter to end input): ")
while name != '':
    if not name in phoneBook:
        number = input("Please enter number: ")
    print "Phone number: " + number
    phoneBook[name] = number
    name = input("Please enter a name(or press enter to end input): ")
    if name in phoneBook:
        print phoneBook[name]
    if name == '':
        break
print phoneBook

```

Expected result: 

```
    Phone number: 1234
    Phone number: 5678
    {'Tracy': '5678', 'Karel': '1234', 'Steve': '9999'}

```

My result: 

```
Phone number: 1234
Phone number: 5678
Phone number: 9999
1234
Phone number: 9999
5678
Phone number: 9999
{'Tracy': '9999', 'Karel': '9999', 'Steve': '9999'}

```

Answer: 
Usually in these cases, You have something in front of the call that is handling the request and passing it off to the "worker" classes (e.g. TestApp). If this is the case, I don't see why having an "IAsyncable" interface where you could test if the class was async capable would not work.

```
if(thisObject is IAscyncAble) {
  ... call the ansync request.
}

```
I ended up using the following code:

```
using System.IO;
using System.Threading.Tasks;

namespace TestApp
{
    interface IBlackBox // interface for both sync and async execution
    {
        Task<string> PullText();
    }

    sealed class MyAsyncBlackBox : IBlackBox
    {
        public async Task<string> PullText()
        {
            using (var reader = File.OpenText("Words.txt"))
            {
                return await reader.ReadToEndAsync();
            }
        }
    }

    sealed class MyCachedBlackBox : IBlackBox
    {
        public Task<string> PullText() // notice no 'async' keyword
        {
            return Task.FromResult("hello world");
        }
    }
}

```