208k views
0 votes
Which is an example of the proper use of the Python input() function?

a. answer = input(enter your answer: )
b. answer = INPUT(enter your answer: )
c. answer = input("enter your answer: ")
d. answer = INPUT("enter your answer: ")

User Lith
by
8.5k points

1 Answer

3 votes

Final answer:

The correct usage of the Python input() function is shown in option c where it is written in lowercase and includes a prompt in double quotes.

Step-by-step explanation:

The proper use of the Python input() function is to prompt the user to enter some information and then capture that input as a variable. Among the options provided, the correct one is c. answer = input("enter your answer: "). This code uses the input function correctly by including a prompt string argument in double quotes and assigns the user's input to the variable answer. It is case-sensitive and should be spelled correctly in lowercase. Options a, b, and d either lack the necessary quotation marks around the prompt or use an incorrect case, as Python is case-sensitive with its functions.

User Royi Namir
by
8.2k points

No related questions found