+ 7

Please explain it

What is the output of this code. L= list(range(10)) print(L.pop() +max(L))

24th Jun 2019, 10:45 AM
Mohd Vais
Mohd Vais - avatar
4 Respuestas
+ 14
L=list(range(10)) >>> L >>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] L.pop() >>>9 L >>>[0, 1, 2, 3, 4, 5, 6, 7, 8] max(L) >>>8 9+8=17 and that is the answer.
24th Jun 2019, 10:53 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 12
L gives you 0 - 9; L.pop() method gives you last number - 9 and splice it so last value is now 8; max(L) gives you now 8 (it's maximal value) ; 8 + 9 = 17
24th Jun 2019, 10:57 AM
r8w9
r8w9 - avatar
+ 12
Prometheus ¯\_(ツ)_/¯ 🇸🇬 is faster than a speed of light :D
24th Jun 2019, 11:02 AM
r8w9
r8w9 - avatar
+ 9
Haha r8w9 I just patrol the Most Recent section frequently ;)
24th Jun 2019, 11:04 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar