+ 1
nums = (55, 44, 33, 22) print(max(min(nums[:2]), abs(-42)))
What is the output? the output is 44. How it comes 44? Can anyone explain it to me?
15 Réponses
+ 11
44
+ 9
Trace backwards from the inner parentheses:
nums[:2] is (55, 44)
min(nums[:2]) is min((55, 44)), which is...
abs(-42) is 42
max(x, y) returns the greatest between x and y
...
+ 5
Here, you have to be very carefull!!!
Because of parenthesis and then you can easily do it.
nums = (55, 44, 33, 22)
print(max(min(nums[:2]),abs(-42)))
print(max(min(55,44),abs(-42)))
print(max(44,42))
print(44)
Hence Output : - 44
+ 5
The answer is 44 not 30, they're lying
+ 5
nums = (55, 44, 33, 22)
print(max(min(nums[:2]), abs(-42)))
Solution
1. nums[:2] means numbers between num[0]-num[2]= {55,44}
2. min(nums[:2]) = min(55, 44) = 44
3. abs(-42) =absolute value of (-42) = 42
4. max(min(nums[:2]), abs(-42)) = max(44, 42) = 44
5. print(44)
hence the final answer is 44
+ 2
ok this solo llearn cool app but DAMN this question have too much math in it
+ 1
44
+ 1
answer is 44
+ 1
44
0
How to inteprete abs(-42)?
0
The abs() function returns the absolute value of the given number.
so the answer is 44
0
44
0
nums = (55, 44, 33, 22)
print(max(min(nums[:2]), abs(-42)))
#nums[:2]> (55,44)
# min(nums[:2]) > min(55,44)>44
# abs(-42)>42
# (max(min(nums[:2]), abs(-42))> max(44,42)>44
Output >>44
- 1
30
- 6
ans is 30