+ 3

why I got None too?

in line 8 if I type "print(res)" I got None too next to answer, while if I type "return res" I got just the answer https://code.sololearn.com/cJ0m9ArIu6PC/?ref=app

24th Sep 2018, 1:54 PM
sama baluom
sama baluom - avatar
6 Réponses
+ 3
In order to print the result of the function you ought to pass it to a caller. That is why we use return method. When you just print the result in your subroutine without returning it to a caller, the caller whill get 'None' as a result by default, and print it out. In outher words, if you do not pass the result with return method explicitly, the function passes rerurn None inplicitly. And this is what caller gets and prints.
24th Sep 2018, 2:07 PM
strawdog
strawdog - avatar
+ 2
it is simple but if we ask suddenly we might not answer to that,tq for this q so we can recall those small things
2nd Oct 2018, 3:30 AM
G.Anjali Jha
G.Anjali Jha - avatar
25th Sep 2018, 1:09 PM
Joshua Martin Fontanilla
Joshua Martin Fontanilla - avatar
0
got it ,thank you
24th Sep 2018, 2:11 PM
sama baluom
sama baluom - avatar
0
Hello ! @sama baluom can you explain me please the purpose of substract_time ?
9th Oct 2018, 7:39 AM
s l
0
s l sure;) , the purpose is to know how much minutes between two times ; time1 should be less than time2 , the example i used is time1=(21,0) ( that is 9 pm) and time2 is (23,2) that is 11:2 pm , what i want is the difference time between those two times by minutes ,and its 122 mins^^, ask me if its not clear;)
9th Oct 2018, 7:47 AM
sama baluom
sama baluom - avatar