

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


def setDuplicate(L):
duplicate = set({}) for x in L: if L.count(x) > 1 and x not in duplicate: duplicate.add(x) return duplicate
L = ["Java", "Python", "J2EE", "Java", "MySQL", "SQLite", "Python", "C++", "MySQL"] print("l'ensemble des éléments dupliqués est : ", setDuplicate(L))
'Java', 'MySQL'}
def motsCommuns(s1,s2): L1 = s1.split() L2 = s2.split() communs = [] for x in L1: if(x in L2): communs.append(x) return communs
s1 = " Python est un langage de programmation de haut niveau" s2 = " Python est un langage interprété" print("La liste des mots communs à s1 et s2 est : ",motsCommuns(s1,s2))
notes = [ 12 , 4 , 14 , 11 , 18 , 13 , 7 , 10 , 5 , 9 , 15 , 8 , 14 , 16 ]
moyenne = [] for x in notes:
if(x >= 10 ): moyenne.append(x) print ("La liste contenant uniquement les notes supérieures à la moyenne est:\n", moyenne)