0

Why wouldn't the first list be 55,44,42

(nums [:2]),abs (-42)) would be part of the same list?

19th Jan 2020, 5:55 AM
Daniel Huneycutt
Daniel Huneycutt - avatar
6 Respostas
+ 3
It could be recommended to give a link to the lesson or code you are referring, but I think I know which lesson you are talking about.
19th Jan 2020, 7:23 AM
Seb TheS
Seb TheS - avatar
19th Jan 2020, 7:31 AM
Seb TheS
Seb TheS - avatar
+ 1
The quiz asked about the result of this code: nums = [55, 44, 33, 22] print(max(min(nums[:2]), abs(-42))) It is just about solving those functions, from the innermost to the outermost. print(max(min(nums[:2]), abs(-42))) - - - - nums[:2] - -> [55, 44] - - - - abs(-42) - -> 42 print(max(min([55, 44, 33]), 42)) - - - - min([55, 44]) - -> 44 print(max(44, 42)) - - - - max(44, 42) - -> 44 print(44)
19th Jan 2020, 7:37 AM
Seb TheS
Seb TheS - avatar
+ 1
nums[:2] is a slice from [55, 44, 33, 22] [:2] refers on taking the first 2 items from the list: [55, 44] It has nothing to do with abs(-42). min(nums[:2]) and abs(-42) are only 2 independent arguments for function max.
19th Jan 2020, 7:45 AM
Seb TheS
Seb TheS - avatar
0
Sorry. First time commenting on this app. That is the one though!
19th Jan 2020, 7:36 AM
Daniel Huneycutt
Daniel Huneycutt - avatar
0
Okay I see. I was thinking it became a list in itself inside of the function. Thank you for clarifying that!
19th Jan 2020, 8:17 AM
Daniel Huneycutt
Daniel Huneycutt - avatar