DEV Community

Discussion on: Python challenge_10

Collapse
 
cyzy666 profile image
Cyzy666

I think another "short" solution would be to use the sorted() function. Like this:

def largest_difference(nums):
    return sorted(nums)[-1] - sorted(nums)[0]
Enter fullscreen mode Exit fullscreen mode
Collapse
 
mahmoudessam profile image
Mahmoud EL-kariouny

Thanks for sharing you can test your solution here: pythonprinciples.com/challenges/