I need help to find the max and min of a tuple | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

8th Mar 2020, 2:50 AM
Tan
1 Answer
+ 1
omg thanks !
8th Mar 2020, 3:09 AM
Tan