Computer Science
What will be the output produced by following code ?
>>> print (print ("Hola", end = ""))
Python
Python Funda
8 Likes
Answer
Output
HolaNone
Explanation
First, print ("Hola", end = "") function is executed which prints Hola. As end argument is specified as "" so newline is not printed after Hola. The next output starts from the same line. The return value of print() function is None i.e. nothing. This is passed as argument to the outer print function which converts it into string and prints None in the same line after Hola.
Answered By
3 Likes
Related Questions
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"))
Carefully look at the following code and its execution on Python shell. Why is the last assignment giving error ?
>>> a = 0o12 >>> print(a) 10 >>> b = 0o13 >>> c = 0o78 File "<python-input-41-27fbe2fd265f>", line 1 c = 0o78 ^ SyntaxError : invalid syntax
Predict the output
a, b, c = 2, 3, 4 a, b, c = a*a, a*b, a*c print(a, b, c)