Bird
0
0

Identify the error in this Agile test automation code snippet:

medium📝 Debug Q6 of 15
Testing Fundamentals - Testing Models and Approaches
Identify the error in this Agile test automation code snippet:
def run_tests(tests):
    for test in tests
        print(f"Running {test}")

run_tests(['login', 'logout'])
AMissing colon after for loop
BIncorrect function call syntax
CPrint statement missing parentheses
DList syntax is invalid
Step-by-Step Solution
Solution:
  1. Step 1: Check for syntax errors in for loop

    The for loop line lacks a colon at the end, which is required in Python.
  2. Step 2: Verify other parts of code

    Function call and print syntax are correct; list syntax is valid.
  3. Final Answer:

    Missing colon after for loop -> Option A
  4. Quick Check:

    Python syntax requires colon after for [OK]
Quick Trick: Always put a colon after for loops in Python [OK]
Common Mistakes:
  • Forgetting colon after for statement
  • Thinking print needs no parentheses in Python 3
  • Misreading list syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Testing Fundamentals Quizzes