+ 1

Would you help me to understand this code ? (regarding lists and dictionaries)

Hi friends I have question regarding the logic of this code, I know its goal but want to understand the logic of lines 2, 7, 8 & 9 https://code.sololearn.com/c2PMm9D1CQrg/#py

15th Apr 2018, 9:30 PM
NIMA
NIMA - avatar
3 Respostas
+ 3
Here. I am a tutor so I tend to go into a lot of details when I explain to make sure things are clear so sorry if you feel I wrote too much. ☺ So, read the comments in the code below https://code.sololearn.com/cxuTfB3vkRtx/?ref=app
15th Apr 2018, 11:07 PM
cyk
cyk - avatar
+ 3
Line 2 definition of bozorge and line 8 usage serves no purpose. max could have been used in 8 instead. To have a reason for something like this, you would have to pick min or max at line 2. Then, lines 8 would save execution as the deciding which function only occurs once, not each time through the loop.
15th Apr 2018, 11:05 PM
John Wells
John Wells - avatar
+ 1
Thank you cyk, it is the most descriptive and clear answer that I received until now.
16th Apr 2018, 7:35 PM
NIMA
NIMA - avatar