i'm very new to python so please forgive me if my error is blatantly obvious.
The issue I am having is with line 15. I am struggling to check if the input value is NOT in the list "list"
All values currently entered (in and not in the list "list") will return the response "srry".
I know line 15 is at fault because if I create a separate list with no nested lists for the countries: England, French and Mandarin to be called just for line 15, the appropriate response based on input is printed as expected.
Any help would be highly appreciative.
#input
lang = str(input("Please Type in the Language you speak and press enter
('make sure you use a capital letter')"))
#list of countries
list = [["English", "english"], ["French", "french"], ["Mandarin",
"mandarin"]]
#list of responses
lls = ["Hello,", "Bonjour,", "Ni Hao"]
srry = "Sorry, but I don't speak that"
welcmsg = "Welcome to Coventry"
# check if input is not in list
if str(lang) not in list:
print(srry)
#provide appropriate response based on input
elif str(lang) in list[0]:
print(lls[0] + " " + welcmsg)
elif str(lang) in list[1]:
print(lls[1] + " " +welcmsg)
elif str(lang) in list[2]:
print(lls[2])