0
print("hello", print("world"))

why there is a none after the word "hello"

Yashas M B
  • 11
  • 1

2 Answers2

-1

It looks like you are trying to do

print("hello", "world")

Expressions (like print(something)) are evaluated from the inside-out. That lets you do stuff like

print(1 + 2)
# prints 3

The return value of print is None. So when you run print("hello", print("world")), first "world" is printed, and then you essentially have print("hello", None).

Axel Jacobsen
  • 148
  • 10
-1

Because print itself does not return anything, i.e. it returns None. Your nested print statements are evaluated from the inside out, that is why world prints first and then hello + the return value of print = None

bimtauer
  • 29
  • 5