Last active
November 15, 2016 15:38
-
-
Save RossignolVincent/921888bc44467182df95532debe138b5 to your computer and use it in GitHub Desktop.
Pair Product
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def pairProduct (input) : | |
minProduct = 1 | |
maxProduct = 1 | |
tmp_list = list(input) | |
if not input : | |
print(0,0) | |
return | |
for i in range (0,2) : | |
if input : | |
minProduct *= min(input) | |
input.remove(min(input)) | |
for j in range (0,2) : | |
if tmp_list : | |
maxProduct *= max(tmp_list) | |
tmp_list.remove(max(tmp_list)) | |
print(minProduct, maxProduct) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment