निम्नलिखित पायथन फ़ंक्शन का आउटपुट क्या होगा?
What will be the output of the following Python code?
sys.stdout.write(' Hello\n')
sys.stdout.write('Python\n')
A)
B)
C)
D)
Explanation:
The code uses sys.stdout.write()
to print text:
sys.stdout.write(' Hello\n')
prints " Hello" and moves to the next line because of the\n
.sys.stdout.write('Python\n')
then prints "Python" and moves to the next line.
Thus, the output is:
Hello
Python
Correct answer: (D) Hello Python