Created
October 12, 2022 06:56
-
-
Save RaMSFT/1b42a045f8c18bf8b77c6556bfa5a4a9 to your computer and use it in GitHub Desktop.
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 difference_max_min(lst): | |
| """Find the difference between largest and smallest numbers from a list | |
| Args: | |
| lst (numerics): a list of numbers | |
| Returns: | |
| number: difference between largest and smallest numbers of the list | |
| """ | |
| smallest = min(lst) | |
| largest = max(lst) | |
| diff = largest - smallest | |
| return diff | |
| print(difference_max_min([10, 4, 1, 4, -10, -50, 32, 21]) ) | |
| print(difference_max_min([44, 32, 86, 19]) ) | |
| print(difference_max_min([34, 15, 88, 2])) | |
| print(difference_max_min([34, -345, -1, 100]) ) | |
| print(difference_max_min([-76, 1.345, 1, 0]) ) | |
| print(difference_max_min([0.4356, 0.8795, 0.5435, -0.9999]) ) | |
| print(difference_max_min([7, 7, 7]) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment