Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a new test case to your portfolio list.
Testing Fundamentals
portfolio = [] portfolio.[1]('Test login functionality')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using remove or pop will delete items instead of adding.
✗ Incorrect
Use append to add a new test case to the list.
2fill in blank
mediumComplete the code to check if 'Test API' is in your portfolio.
Testing Fundamentals
if 'Test API' [1] portfolio: print('Test case found')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'not in' will check the opposite condition.
✗ Incorrect
The keyword in checks if an item is inside a list.
3fill in blank
hardFix the error in the code to print the number of test cases in the portfolio.
Testing Fundamentals
print('Total tests:', [1](portfolio))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to call len as a method on the list causes an error.
✗ Incorrect
Use the built-in function len() to get the number of items in a list.
4fill in blank
hardFill both blanks to create a dictionary of test names and their status.
Testing Fundamentals
test_status = {test: [1] for test in portfolio if test [2] 'Test login functionality'} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of '!=' will include only the login test.
✗ Incorrect
Assign 'passed' status to tests not equal to 'Test login functionality'.
5fill in blank
hardFill all three blanks to filter and map test cases with 'passed' status.
Testing Fundamentals
passed_tests = {test[1]: status for test, status in test_status.items() if status [2] [3] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '!=' instead of '==' changes the filter logic.
✗ Incorrect
Use .upper() to capitalize test names, check if status equals 'passed'.