# Use De Morgan's Laws to simplify: not (x > 5 and x < 10) is equivalent to (x <= 5 or x >= 10)

Canonical URL: <https://datadriven.io/problems/use-de-morgans-laws-to-simplify-not-x-5-and-x-10-is-0d0e4a84>

Domain: Python · Difficulty: medium

## Problem

Use De Morgan's Laws to simplify: not (x > 5 and x < 10) is equivalent to (x <= 5 or x >= 10). Test with x = 3 and x = 7. Print whether each x is outside the range [6, 9] using both forms.

## Related

- [All practice problems](https://datadriven.io/problems)
- [Mock interview mode](https://datadriven.io/interview/use-de-morgans-laws-to-simplify-not-x-5-and-x-10-is-0d0e4a84)
- [Python Interview Questions](https://datadriven.io/python-interview-questions)
- [Data Engineering Interview Prep Guide](https://datadriven.io/data-engineer-interview-prep)
- [Daily Challenge](https://datadriven.io/daily)

---

Source: DataDriven (https://datadriven.io). 100% free data engineering interview prep. Live code execution against Postgres 16, Python 3.11, and Spark sandboxes. No paywall, no premium tier, no signup gate.