0

In what condition a python programming displays "None " . Sometimes it is also getting displayed while executing a function .

Now-a-days , I am facing this issue .. Can anybody explain it using a small example where this issue happens !

7th Jun 2021, 7:44 AM
ch Murali
9 Respuestas
+ 3
It happens when a function doesn't return anything and you print it's return value . Example: https://code.sololearn.com/c9Eud8qs4xoX/?ref=app
7th Jun 2021, 7:48 AM
The future is now thanks to science
The future is now thanks to science - avatar
7th Jun 2021, 8:03 AM
ch Murali
+ 1
Ok thanks a lot !!
9th Jun 2021, 2:21 PM
ch Murali
+ 1
def some_function(): print(“Hello from the function”) print(some_function()) output: Hello from the function None
24th Jun 2021, 9:52 AM
Hector Gustavo Serrano Gutierrez
Hector Gustavo Serrano Gutierrez - avatar
+ 1
def some_function(): return “Hello by the function” print(some_function()) output: Hello by the function
24th Jun 2021, 10:03 AM
Hector Gustavo Serrano Gutierrez
Hector Gustavo Serrano Gutierrez - avatar
+ 1
def some_function(): print(“Hello from the function”) some_function() output: Hello from the function
24th Jun 2021, 10:06 AM
Hector Gustavo Serrano Gutierrez
Hector Gustavo Serrano Gutierrez - avatar
+ 1
def some_function(): return “Hello by the function” some_function() output:
24th Jun 2021, 10:07 AM
Hector Gustavo Serrano Gutierrez
Hector Gustavo Serrano Gutierrez - avatar
0
Suppose we have a condition where we shouldn't return the value in a function ! and we should avoid the none to get printed then what we should do ? It is possible ? The future is now thanks to science[LESS ACTIVE]
9th Jun 2021, 1:25 PM
ch Murali
0
Then just call the function don't need to print the output from it. for example, hello() here it will call only the hello function and won't print none.
9th Jun 2021, 1:27 PM
The future is now thanks to science
The future is now thanks to science - avatar