+ 1
Order of operations?
A question in the module asked what 'a' results in a=min([sum([11,22]), max(abs(-30),2)]) print(a) I ran the code, and I know it's 30. But why? On one side im seeing min(33) and then max(30), which makes no sense.
9 ответов
+ 4
make attention to the brackets
sum([11,22]) is 33
Max(abs(-30),2) is Max(30 , 2)
Max(30,2) is 30
then
the Min(33,30) is still 30
0
max takes the biggest , while min takes the
smallest.
0
As you can see in program sum of 11 and 22 is 33 and max of abs(-30) and 2 is 30 then finaly the min of results i.e., 33 and 30 is 30 so ans.is 30
0
What is the result of this code?
a=min([sum([11, 22]), max(abs(-30), 2)])
print(a)
30
0
a=min(
[
sum(
[11, 22] # =33
),
max(
abs(-30), 2 #=30
)
]
)
# a=min(33,30)
print(a) = 30
I didn't realise that the MIN part included both results and not just the first two numbers.
0
sum([11,22]) is 33
Max(abs(-30),2) is Max(30 , 2)
Max(30,2) is 30
then
the Min(33,30) is still 30
Ans: 30
0
program : a = min([sum([11,22]),max(abs(-30),2)])
print(a)
output : 30
0
What is the result of this code?
a=min([sum([11, 22]), max(abs(-30), 2)])
print(a)
30
- 2
i don't speak english...only spanish