Voici la liste de tous les mots autorisés au Scrabble qui contiennent un Q mais pas de U. Hélas des erreurs se sont glissées, à vous de les retrouver en créant une fonction intrus. Proposez 2 versions.
mots = coq#faq#qat#qin#cinq#coqs#faqs#fiqh#qats#qing#qins#fiqhs#maqam#niqab#qibla#qings#maqams#uasdaq#niqabs#paqson#qasida#qatari#qiblas#qwerty#qwertz#tariqa#iraqien#nasdaqs#paqsons#qaddich#qaraite#qasidas#qatarie#qataris#qawwali#tariqas#iraqiens#qaddichs#qaraites#katarien#qataries#qawwalis#tamacheq#iraqienne#qatariens#qatariote#tamacheqs#iraqiennes#qatarienne#qatariotes#qatariennes"
mots = "coq#faq#qat#qin#cinq#coqs#faqs#fiqh#qats#qing#qins#fiqhs#maqam#niqab#qibla#qings#maqams#uasdaq#niqabs#paqson#qasida#qatari#qiblas#qwerty#qwertz#tariqa#iraqien#nasdaqs#paqsons#qaddich#qaraite#qasidas#qatarie#qataris#qawwali#tariqas#iraqiens#qaddichs#qaraites#katarien#qataries#qawwalis#tamacheq#iraqienne#qatariens#qatariote#tamacheqs#iraqiennes#qatarienne#qatariotes#qatariennes" def intrus(mots): return [x for x in mots.split("#") if not(("q" in x) and not("u" in x))] # intrus(mots) donne ["uasdaq","katarien"] # Version 2 en utilisant la negation # non(q ET non(u)) = non(q) OU u def intrus2(mots): return [x for x in mots.split("#") if not("q" in x) or ("u" in x)] def intrus3(mots): return list(filter(lambda x:not("q" in x) or ("u" in x), mots.split("#")))