Multiple choice

Which of the following is correct syntax for an input statement to store your name?

  1. name == input

  2. name = input("Enter your name: ")

  3. name == input("Enter your name: ")

  4. name = int(input("Enter your name: "))

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

In Python, the input function is used to capture user input, and the assignment operator (=) stores that value into a variable. Option B correctly uses the function with a prompt string.