tuples
This commit is contained in:
parent
c0244b5822
commit
61dc873489
5 changed files with 60 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
|||
def find_max_min(numbers):
|
||||
if not numbers:
|
||||
return None, None
|
||||
return (None, None)
|
||||
|
||||
max_num = numbers[0]
|
||||
min_num = numbers[0]
|
||||
|
|
@ -11,7 +11,7 @@ def find_max_min(numbers):
|
|||
if num < min_num:
|
||||
min_num = num
|
||||
|
||||
return max_num, min_num
|
||||
return (max_num, min_num)
|
||||
|
||||
def reverse_list(items):
|
||||
reversed_items = []
|
||||
|
|
@ -20,7 +20,7 @@ def reverse_list(items):
|
|||
return reversed_items
|
||||
|
||||
numbers = [3, 1, 4, 1, 5, 9, 2, 6]
|
||||
max_val, min_val = find_max_min(numbers)
|
||||
(max_val, min_val) = find_max_min(numbers)
|
||||
print(f"List: {numbers}")
|
||||
print(f"Max: {max_val}, Min: {min_val}")
|
||||
print(f"Reversed: {reverse_list(numbers)}")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue