The condition uses '=' which is assignment, not comparison. It should be '==' to compare values.
Step 2: Confirm correct syntax for if condition
Using '=' in if causes a syntax error; '==' is needed to check if obstacle is true.
Final Answer:
Using '=' instead of '==' in the if condition -> Option A
Quick Check:
Comparison needs '==' not '=' = B [OK]
Hint: Use '==' to compare, '=' to assign [OK]
Common Mistakes:
Confusing assignment '=' with comparison '=='
Forgetting colon after if statement
Misaligning else block indentation
5. An autonomous cleaning robot uses sensors to detect dirt and obstacles. It must decide to clean, avoid, or recharge. Which approach helps it make the best autonomous decisions?
hard
A. Use fixed rules ignoring sensor data
B. Randomly choose actions without sensing
C. Learn from sensor data and past actions to improve decisions
D. Wait for human commands before every action
Solution
Step 1: Understand the role of sensors and learning
Sensors provide data about the environment; learning helps improve decisions based on experience.
Step 2: Identify the best approach for autonomous decision-making
Learning from sensor data and past actions allows the robot to adapt and make better choices over time.
Final Answer:
Learn from sensor data and past actions to improve decisions -> Option C
Quick Check:
Learning + sensing = better autonomy = C [OK]
Hint: Best autonomy combines sensing and learning [OK]