Bird
0
0

Which of the following is the correct way to ask the user for their name using input()?

easy📝 Syntax Q12 of 15
Python - Input and Output
Which of the following is the correct way to ask the user for their name using input()?
Aname = input Enter your name:
Bname = input('Enter your name: ')
Cname = input['Enter your name:']
Dname = input{Enter your name:}
Step-by-Step Solution
Solution:
  1. Step 1: Check the syntax of input() with prompt

    The prompt must be inside parentheses and quotes, like input('prompt').
  2. Step 2: Identify the correct option

    Only name = input('Enter your name: ') uses parentheses and quotes correctly to show the prompt.
  3. Final Answer:

    name = input('Enter your name: ') -> Option B
  4. Quick Check:

    Prompt text inside parentheses and quotes [OK]
Quick Trick: Use parentheses and quotes for prompt text in input() [OK]
Common Mistakes:
MISTAKES
  • Missing parentheses around prompt
  • Using brackets or braces instead of parentheses
  • Not putting prompt text inside quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes