Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Zadanie 1
- dupl = [1, 1, 3, 77, 23, 4, 14, 23, 9]
- def remDuplAndSort(lista):
- noDupl = []
- for i in lista:
- if i not in noDupl :
- noDupl.append(i)
- return sorted(noDupl)
- print(remDuplAndSort(dupl))
- # Zadanie 2
- l1 = range(1,55,2)
- l2 = range(20,40,3)
- def findCommon(list1, list2):
- common = []
- for i in list1:
- if i in list2:
- common.append(i)
- return common
- print(findCommon(l1,l2))
- #Zadanie 3
- def wzor(masa):
- wzor2=[]
- C, O, H=12, 16, 1
- for x in range(15):
- for y in range(15):
- for z in range(15):
- if x*C + y*H + z*O == masa:
- wzor2.append(("C"+str(x) +"H"+ str(y) + "O" + str(z)))
- return wzor2
- print(wzor(180))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement