0
I need help to find the max and min of a tuple
My code is def max_and_min(values): v = (values) max_value = 0 min_value = 0 for item in v: if item >= max_value: max_value = item for item in v: if item <= max_value: min_value = item for item in v: if item <= min_value: min_value = item return (max_value,min_value) It doesn't work for all eleemtns that's are negative. i can use the max or min function in python
1 Réponse
+ 1
omg thanks !