0

why doesn't it work this way. pyton

hello poeple, if have an question that is: why does this pyton code work on example 1, but not on example 2? example 1: working def selected_lang(x): if x == 1: print("Gekozen taal: nederlands") elif x == 2: print("selected language: English") def lang(): language = input('choose a language. "dutch" or "english".\nenter your choice: ') language = language.lower() if language == "dutch": return selected_lang(1) elif language == "english": return selected_lang(2) elif language == "q": return quit() if language != "dutch" or "english" or "q": print ("\nThis language is not available. \nChoose a language from the full list of available languages.") return lang() print('The Romantic Story Game\n') print("Made by Sebastiaan van de Wetering\n") input("press enter to continue...") print(" ") lang() example 2: not working def selected_lang(x): if x == 1: print("Gekozen taal: nederlands") elif x == 2: print("selected language: English") def lang(): language = input('choose a language. "dutch" or "english".\nenter your choice: ') language = language.lower() if language != "dutch" or "english" or "q": print ("\nThis language is not available. \nChoose a language from the full list of available languages.") return lang() elif language == "dutch": return selected_lang(1) elif language == "english": return selected_lang(2) elif language == "q": return quit() print('The Romantic Story Game\n') print("Made by Sebastiaan van de Wetering\n") input("press enter to continue...") print(" ") lang() Regards sebastiaan

31st Aug 2017, 8:55 PM
sebastiaan
3 Réponses
0
i have change if language != "Dutch" or "english" or "q": into if not (language == "dutch" or "english" or "q"): and this works #example 2: working version def selected_lang(x): if x == 1: print("Gekozen taal: nederlands") elif x == 2: print("selected language: English") def lang(): language = input('choose a language. "dutch" or "english".\nenter your choice: ') language = language.lower() if not (language == "dutch" or "english" or "q"): print ("\nThis language is not available. \nChoose a language from the full list of available languages.") return lang() elif language == "dutch": return selected_lang(1) elif language == "english": return selected_lang(2) elif language == "q": return quit() print('The Romantic Story Game\n') print("Made by Sebastiaan van de Wetering\n") print(" ") lang()
1st Sep 2017, 10:45 AM
sebastiaan
0
i wil try now
31st Aug 2017, 8:17 PM
sebastiaan
0
If language != "nederlands" or language != "english" or language != "q". didn't work :( i have also changed nederlands into dutch. that doesn't work either.
31st Aug 2017, 8:44 PM
sebastiaan