Computer Science
What will be the output produced by following code ?
>>> str(print())+"One"
Python
Python Funda
20 Likes
Answer
Output
'NoneOne'
Explanation
print() function doesn't return any value so its return value is None. Hence, str(print()) becomes str(None). str(None) converts None into string 'None' and addition operator joins 'None' and 'One' to give the final output as 'NoneOne'.
Answered By
10 Likes
Related Questions
Find the errors in following code fragment :
c = input( "Enter your class" ) print ("Last year you were in class") c - 1What 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("hello"))+"One"
What will be the output produced by following code ?
>>> print(print("Hola"))