Created
June 1, 2020 10:07
-
-
Save kurzweil777/5800d557de92f6412a2a523284a0abc9 to your computer and use it in GitHub Desktop.
Exercise_from_CodeWars
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 high_and_low(numbers): | |
| """In this little assignment you are given a string of space separated numbers, and have to return the highest | |
| and lowest number. """ | |
| int_numbers = [] # Creating a list for inputting integers | |
| for number in numbers.split(): # Iteration through the string with numbers | |
| int_numbers.append(int(number)) # Writing integers into a created list | |
| new_numbers = sorted(int_numbers) # Sorting numbers | |
| return str(new_numbers[-1]) + " " + str(new_numbers[0]) # Returning the result | |
| print(high_and_low("542 9 3 4 -214")) # return "542 -214" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment