why I got None too? | Sololearn: Learn to code for FREE!

+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

9/24/2018 1:54:15 PM

sama baluom

6 Answers

New Answer

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

+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

+1

strawdog 🇷🇺 Niceone

0

got it ,thank you

0

Hello ! @sama baluom can you explain me please the purpose of substract_time ?

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;)