Code initial de l’exercice 2
Code:
from typing import List
from random import randint
def has_duplicates(l: List[int]) -> bool:
...
print(has_duplicates([])) # False
print(has_duplicates([9, 3, 2, 5, 1])) # False
print(has_duplicates([1, 1])) # True
print(has_duplicates([1, 2, 2, 3, 1, 5, 1])) # True
def find_duplicates(l: List[int]) -> List[int]:
...
print(find_duplicates([])) # []
print(find_duplicates([1, 2, 3, 5, 9])) # []
print(find_duplicates([1, 1])) # [1]
print(find_duplicates([1, 2, 2, 3, 1, 5, 1])) # [1, 2] ou [2, 1]
from random import randint
def has_duplicates(l: List[int]) -> bool:
...
print(has_duplicates([])) # False
print(has_duplicates([9, 3, 2, 5, 1])) # False
print(has_duplicates([1, 1])) # True
print(has_duplicates([1, 2, 2, 3, 1, 5, 1])) # True
def find_duplicates(l: List[int]) -> List[int]:
...
print(find_duplicates([])) # []
print(find_duplicates([1, 2, 3, 5, 9])) # []
print(find_duplicates([1, 1])) # [1]
print(find_duplicates([1, 2, 2, 3, 1, 5, 1])) # [1, 2] ou [2, 1]
Last modified: Friday, 1 November 2019, 10:18