What will be the output of the following Python code? [code] str = raw_input("Enter your input: "); print "Received input is : ", str [/code]

Đức Linh

New member
What will be the output of the following Python code?
Code:
str = raw_input("Enter your input: ");
print "Received input is : ", str
A.
Enter your input: Hello Python
Received input is : Hello Python
B.
Enter your input: Hello Python
Received input is : Hello
C.
Enter your input: Hello Python
Received input is : Python
D. None of the mentioned
 
Answer: a
Explanation: The raw_input([prompt]) function reads one line from standard input and returns it as a string. This would prompt you to enter any string and it would display same string on the screen. When I typed “Hello Python!”
 

Tìm kiếm

Back
Top