Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the test progress percentage.
Testing Fundamentals
total_tests = 50 completed_tests = 20 progress = (completed_tests [1] total_tests) * 100 print(f"Progress: {progress}%")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of division causes wrong progress calculation.
Adding or subtracting numbers instead of dividing.
✗ Incorrect
To calculate progress percentage, divide completed tests by total tests.
2fill in blank
mediumComplete the code to update the progress bar width based on test progress.
Testing Fundamentals
progress_percent = 75 progress_bar_style = f"width: [1]%" print(progress_bar_style)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using variables that do not represent percentage causes wrong style.
Forgetting to include the percent sign in the style string.
✗ Incorrect
The variable progress_percent holds the current progress value to set the width.
3fill in blank
hardFix the error in the code that calculates and prints test progress.
Testing Fundamentals
total = 40 completed = 10 progress = completed [1] total * 100 print(f"Test progress: {progress}%")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using multiplication instead of division.
Using addition or subtraction which gives wrong results.
✗ Incorrect
Division is needed to get the fraction of tests completed before multiplying by 100.
4fill in blank
hardFill both blanks to create a dictionary showing test names and their pass status.
Testing Fundamentals
tests = ['login', 'signup', 'checkout'] results = [True, False, True] status = {tests[1]: results[2] for i in range(len(tests))} print(status)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of square brackets causes errors.
Mixing up the index variable or forgetting brackets.
✗ Incorrect
Use square brackets to access list elements by index.
5fill in blank
hardFill all three blanks to filter tests that passed and create a summary dictionary.
Testing Fundamentals
tests = ['login', 'signup', 'checkout', 'profile'] results = [True, False, True, False] summary = {tests[1]: results[2] for i in range(len(tests)) if results[i][3] print(summary)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of square brackets for list access.
Forgetting to compare result to True in the if condition.
✗ Incorrect
Use square brackets to access list items and filter where result is True.