+ 1

Why does it print none

def my_func(): print("spam") print("spam") print("spam") print(my_func())

28th May 2020, 9:56 AM
SATYANSH MITTAL
SATYANSH MITTAL - avatar
3 ответов
+ 2
Because your function has no return statement hence it will return "None" by default
28th May 2020, 9:57 AM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
wonder nature my_func() will do, you need not put it inside a print statement. Also since it is similar to print(print()), hence it returns None.
28th May 2020, 10:03 AM
Avinesh
Avinesh - avatar
0
What is void function
28th May 2020, 10:03 AM
SATYANSH MITTAL
SATYANSH MITTAL - avatar