Question 1 - another way using user_inpt.isdigit() in while loop
Hi,
I tried to do it another way using isdigit() in while loop and that way it won't break for united states or united kingdom as explained in other alternate solution.. please let me know if this is correct or is it going to break in any other scenario?
user_input = input ('which country would you like to check:>>> ')
while user_input.isdigit():
print ('print enter only strings')
user_input = input ('which country would you like to check: >>>')
if user_input.title() in capitals:
print (f'{capitals[user_input.title()]} is the capital of {user_input}')
else:
print('not found')
1 answers ( 0 marked as helpful)
Your code is lacking the user can still input symbols instead of names and if he entered the country name all caps or all smalls it will fail