About 1,500,000 results
Open links in new tab
  1. python - Why is this printing 'None' in the output? - Stack Overflow

    Mar 2, 2015 · However why does the output return None: Because there are two print statements. First is inside function and second is outside function. When a function doesn't return anything, it implicitly returns None. Use return statement at end of function to return value. e.g.: Return None. ... print "In function." In function. Use return statement. ...

  2. python - getting 'none' at the end of printing a list

    Sep 13, 2016 · When you write print(share_details(share_data)) - it means print the value returned by share_details function. The function returns None after printing the values. If the function doesn't return anything that needs to be printed, it is better to omit the print and just call the function like:

  3. python - Why is "None" printed after my function's output

    It's the return value of the function, which you print out. If there is no return statement (or just a return without an argument), an implicit return None is added to the end of a function. You probably want to return the values in the function instead of printing them: if …

  4. Why does my function print None in Python [Solved] - bobbyhadz

    Apr 8, 2024 · Functions often print None when we pass the result of calling a function that doesn't return anything to the print() function. All functions that don't explicitly return a value, return None in Python. Notice that we called the print () function twice.

  5. Why Python Functions Print None and How to Avoid it

    However, sometimes when working with functions in Python, you may notice that they return a value of None rather than the expected output. In this article, we will explore the reasons why Python functions print None and how this can impact your code.

  6. Why is ‘None’ printed after my function’s output in Python 3?

    Dec 26, 2024 · One possible reason why “None” is printed after the function’s output in Python 3 is that the function does not explicitly return a value. In Python, if a function does not have a return statement, it automatically returns “None” by default.

  7. How to remove "None" from output - Discussions on Python.org

    Aug 14, 2022 · search() has no return statement, so it will by default return None. When you call the search at the bottom, it prints out either Word found or Missing and then it returns None to the caller. The None is passed to the print on that last line and is printed.

  8. Why is it printing "None"? - Python Forum

    Feb 8, 2021 · If you make a function without any return statement inside, the object None is returned implicit. For example print was in Python 2 a statement. Now since long time, print is a function. Also the print function return a None. That's why you got a …

  9. python - Why do I get 'None' as the output from a print statement ...

    Feb 10, 2019 · None isn't the output; it's the return value. The two concepts are completely different. The confusion is that the interactive interpreter, when evaluating a function call, prints its return value to standard output.

  10. r/learnpython on Reddit: Why this code results in "None" instead …

    Feb 20, 2022 · When you call list.remove either one of two things happens: The value you provided is in the list, the value is popped 1 out of the list, modifying the list in place, and None is returned. The value you provided is not in the list, so a ValueError is raised with the message “[value] is not in list”.

  11. Some results have been removed
Refresh