JN0-224 · Question #130
What is the correct Python script syntax to prompt for input?
The correct answer is A. hostIP = input("Device IP address: "). In Python, the correct syntax to prompt the user for input and store that input in a variable is: input(prompt): The input() function is used to take input from the user. The string provided as an argument (inside the parentheses) is displayed as a prompt to the user. The input…
Question
What is the correct Python script syntax to prompt for input?
Options
- AhostIP = input("Device IP address: ")
- BhostIP = input{Device IP address: }
- ChostIP = input"Device IP address: "
- Dinput("Device IP address: ") = hostIP
How the community answered
(39 responses)- A87% (34)
- B3% (1)
- C3% (1)
- D8% (3)
Explanation
In Python, the correct syntax to prompt the user for input and store that input in a variable is: input(prompt): The input() function is used to take input from the user. The string provided as an argument (inside the parentheses) is displayed as a prompt to the user. The input provided by the user is returned as a string and can be stored in a variable.
Topics
Community Discussion
No community discussion yet for this question.