Bird
0
0

This AI script is meant to block certain apps after 8 PM:

medium📝 Analysis Q14 of 15
AI for Everyone - AI for Parents and Families
This AI script is meant to block certain apps after 8 PM:
if current_time > 20:
    block_apps(['game', 'social'])
else:
    allow_apps(['game', 'social'])
What is the error in this script?
AThe else block should block apps instead of allowing
BThe list of apps should be a string, not a list
CThe time comparison should use 24-hour format correctly
DThe function names are incorrect
Step-by-Step Solution
Solution:
  1. Step 1: Check the time comparison logic

    20 means 8 PM in 24-hour format.
  2. Step 2: Verify the logic of else block

    The else block currently allows apps, but it should block them outside allowed times.
  3. Final Answer:

    The else block should block apps instead of allowing -> Option A
  4. Quick Check:

    Else block logic is reversed [OK]
Quick Trick: Check that else block logic matches intended app control [OK]
Common Mistakes:
  • Assuming list of apps must be string
  • Confusing else block logic
  • Ignoring time format importance

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More AI for Everyone Quizzes