KnowledgeBoat Logo

Computer Science

What will be the output produced by following code ?

>>> str(print("hello"))+"One"

Python

Python Funda

16 Likes

Answer

Output

hello 'NoneOne'

Explanation

First, print("hello") function is executed which prints the first line of the output as hello. The return value of print() function is None i.e. nothing. str() function converts it into string and addition operator joins 'None' and 'One' to give the second line of the output as 'NoneOne'.

Answered By

9 Likes


Related Questions