Why output is always Not found? | Sololearn: Learn to code for FREE!

+1

Why output is always Not found?

I made this code about country flags. For example, if our input is Germany then output will be 🇩🇪, so and so. And if input is not in the data then, Not found. But I don't know why it is not working? https://code.sololearn.com/cuaMEeXDWg0Q/?ref=app

7/30/2021 3:40:53 PM

Python Learner

9 Answers

New Answer

+5

I typed "Russia" and it works just fine. What input are you giving?

+5

I got it. I used keyboard auto fill option. I missed to consider the space at the end. Thank you guys 😊

+5

Python Learner When i type the country name fully, its give me correct output (flag), when i try to fill by auto fill option by keyboard suggestion option. It's output(Not found). That's the matter here. But i like your code. Happy learning 💐

+2

Python Learner you must type the uppercase and lowercase letters exactly. It will fail to find "Armenia" if you enter "armenia".

+1

Works fine for me

+1

I'd suggest adding ".capitalize()" to the input function so that you dont have to make everything start with a capital letter manually

+1

U forgot to uppercase the furst letter. I wrote all and its works:)

+1

Python Learner You may find the strip() method useful in this case. It returns a new string with the spaces trimmed from either side (if any). Here's how you do it: input().strip() # Hope this helps

0

It's so easy