nerdexam
Juniper

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…

Python

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)
  • A
    87% (34)
  • B
    3% (1)
  • C
    3% (1)
  • D
    8% (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

#Python input function#syntax#user prompts#variable assignment

Community Discussion

No community discussion yet for this question.

Full JN0-224 Practice