+ 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.

10th Aug 2016, 10:42 PM
Rhys Mucik
Rhys Mucik - avatar
9 Respostas
+ 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
11th Aug 2016, 1:30 PM
Marco Romanin
Marco Romanin - avatar
0
max takes the biggest , while min takes the smallest.
12th Aug 2016, 4:43 AM
Sihe Chen
Sihe Chen - avatar
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
3rd Jul 2019, 7:23 PM
Fathima Khanam
Fathima Khanam - avatar
0
What is the result of this code? a=min([sum([11, 22]), max(abs(-30), 2)]) print(a) 30
3rd Aug 2019, 6:02 AM
GYANENDRA PAL SINGH
GYANENDRA PAL SINGH - avatar
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.
20th Jul 2020, 8:58 AM
Tyler Sandiford
Tyler Sandiford - avatar
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
5th Dec 2020, 4:27 PM
IRFAN KHAN
IRFAN KHAN - avatar
0
program : a = min([sum([11,22]),max(abs(-30),2)]) print(a) output : 30
27th May 2021, 11:51 AM
Madhavareddy
Madhavareddy - avatar
0
What is the result of this code? a=min([sum([11, 22]), max(abs(-30), 2)]) print(a) 30
12th Aug 2021, 7:06 PM
Kamel Habib
Kamel Habib - avatar
- 2
i don't speak english...only spanish
22nd Aug 2016, 12:02 AM
Melvin Alvarez