while working with while loop in python, my code is not taking account double letter string like united states or united kingdom
in mentioned below code's output for string united states and united kingdom:
the out put is : "this country is not in the dictionary".
the output should be its capital value.
Code:
capital = {'France':'paris','spain':'madrid','italy':'rome', 'united states':'washington DC', 'united kingdom':'london'}
user_input = input("Which country would you like to check?>>> ")
user_input = user_input.lower()
while ('united kingdom' not in user_input and not user_input.isalpha()):
if user_input == 'united states':
break
print(" please enter string type only.")
user_input = input("which country would you like to check?>>> ")
user_input = user_input.title()
if user_input in capital:
print(f'the capital of {user_input} is {capital[user_input]}.')
else:
print("this country is not in the dictionary. ")
1: I do not know where is an error?
2: I could not understand this logical statment:
"while 'united kingdom' not in user_input and ......