return doesn't work | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

return doesn't work

in this simple function, return doesn't work: def test(n) a=n return a test(5) why?

11th Sep 2016, 7:52 AM
Marcello
7 Réponses
+ 1
return cant print a value alone. if you want to print your value you should use print like this: print(test(5))
11th Sep 2016, 8:31 AM
ali.gh
ali.gh - avatar
0
thanks, works!! in many guides it's not reported, why?
11th Sep 2016, 9:20 AM
Marcello
0
i dont know but i can tell you that you can use like this: x=test(5) print(x)
11th Sep 2016, 9:42 AM
ali.gh
ali.gh - avatar
0
can i ask you also how remove a value from a lista? thanks in advance
11th Sep 2016, 9:57 AM
Marcello
0
I think that you cant remove a value from a list. if you want to do it you should rewrite it but just all values that you want and if dont rewrite a value it will remove
11th Sep 2016, 10:01 AM
ali.gh
ali.gh - avatar
0
ok, have a nice day thanks
11th Sep 2016, 10:24 AM
Marcello
0
Your welcome. Good luck and have a nice day.
11th Sep 2016, 10:28 AM
ali.gh
ali.gh - avatar