Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Largest Product of Three
- ## Write a function that finds the largest possible product of any three numbers from an array
- ## Extra credit: Make your function handle negative numbers.
- def largestProductOfThree(number):
- #your code here
- return 0
- # Largest Product of Three Tests
- assert largestProductOfThree([2, 1, 3, 7]) == 42, 'largestProductOfThree([2, 1, 3, 7]) should return 42'
- assert largestProductOfThree([4, 2, 1, 10, 10]) == 400, 'largestProductOfThree([4, 2, 1, 10, 10]) should return 400'
- assert largestProductOfThree([2, 1, 3]) == 6, 'largestProductOfThree([2, 1, 3]) should return 6'
Add Comment
Please, Sign In to add comment