Guest User

Untitled

a guest
Jun 20th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. ## Largest Product of Three
  2. ## Write a function that finds the largest possible product of any three numbers from an array
  3. ## Extra credit: Make your function handle negative numbers.
  4.  
  5. def largestProductOfThree(number):
  6. #your code here
  7. return 0
  8.  
  9.  
  10. # Largest Product of Three Tests
  11. assert largestProductOfThree([2, 1, 3, 7]) == 42, 'largestProductOfThree([2, 1, 3, 7]) should return 42'
  12. assert largestProductOfThree([4, 2, 1, 10, 10]) == 400, 'largestProductOfThree([4, 2, 1, 10, 10]) should return 400'
  13. assert largestProductOfThree([2, 1, 3]) == 6, 'largestProductOfThree([2, 1, 3]) should return 6'
Add Comment
Please, Sign In to add comment