Exercise: Python

Questions for: Console Io

How can you read an integer input from the console?
A:
int_input()
B:
read_integer()
C:
int(input())
D:
read.console(integer)
Answer: C
To read an integer input from the console, you can use int(input()) to convert the input string to an integer.
Which function is used to print output to the console?
A:
display()
B:
show()
C:
print()
D:
console.log()
Answer: C
The print() function is used to display output on the console in Python. It can be used to print variables, strings, and expressions.
How can you take user input from the console?
A:
console.input()
B:
input()
C:
read.console()
D:
console.read_input()
Answer: B
The input() function is used to take user input from the console in Python. It reads a line from the console and returns it as a string.
Ad Slot (Above Pagination)
Quiz