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
What will be returned by Python as result of following statements?
(a) >>> type(0)
(b) >>> type(int(0))
(c) >>>.type(int('0')
(d) >>> type('0')
(e) >>> type(1.0)
(f) >>> type(int(1.0))
(g) >>>type(float(0))
(h) >>> type(float(1.0))
(i) >>> type( 3/2)
What will be the output produced by following code ?
>>> str(print())+"One"
What will be the output produced by following code ?
>>> print(print("Hola"))
What will be the output produced by following code ?
>>> print (print ("Hola", end = ""))