Bird
0
0

Identify the problem in this code:

medium📝 Debug Q7 of 15
Python - Input and Output

Identify the problem in this code:

print("{name} scored {score}".format("Alice", 90))

AUsing positional arguments with named placeholders
BMissing format() call
CIncorrect placeholder syntax
DNo problem
Step-by-Step Solution
Solution:
  1. Step 1: Check placeholders and arguments

    Placeholders are named {name} and {score}, but arguments are positional without keywords.
  2. Step 2: Understand mismatch

    Named placeholders require keyword arguments, not positional ones.
  3. Final Answer:

    Using positional arguments with named placeholders -> Option A
  4. Quick Check:

    Named placeholders need keyword arguments [OK]
Quick Trick: Use keyword arguments for named placeholders [OK]
Common Mistakes:
MISTAKES
  • Mixing positional and named arguments incorrectly
  • Not using keywords for named placeholders
  • Expecting positional args to fill named placeholders

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes