Python Programming - Console Input/Output
Exercise : Console Input/Output - General Questions
- Console Input/Output - General Questions
11.
Which function is used to print without a newline?
Answer: Option
Explanation:
To print without a newline in Python, you can use
print("\n", end="")
.
12.
How can you read a floating-point number from the console?
Answer: Option
Explanation:
To read a floating-point number from the console in Python, you can use
float(input())
.
13.
How can you prompt the user with a message and read an integer in a single line?
Answer: Option
Explanation:
To prompt the user with a message and read an integer in a single line, you can use
int(input("Enter an integer: "))
.
14.
How can you read a list of integers from the console?
Answer: Option
Explanation:
To read a list of integers from the console, you can use
list(map(int, input().split()))
.
15.
What is the purpose of the
sep
parameter in the print()
function?
Answer: Option
Explanation:
The
sep
parameter in print()
sets the output separator between the arguments.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers