Exercises · Q9
Q.A dartboard of radius 10 units and the wall it is hanging on are represented using a two-dimensional coordinate system, with the board’s center at coordinate (0,0). Variables x and y store the x-coordinate and the y-coordinate of a dart that hits the dartboard. Write a Python expression using variables x and y that evaluates to True if the dart hits (is within) the dartboard, and then evaluate the expression for these dart coordinates:
a) (0,0)
b) (10,10)
c) (6, 6)
d) (7,8)
Uttar Pradesh UpmspTextbookSubjective· 3mImportance★★★★★est
73% · 36/49 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →The dart is inside the board when its distance from the centre (0,0) is at most the radius 10, i.e. x**2 + y**2 <= 100 — True for (0,0) and (6,6), False for (10,10) and (7,8).
The concept is turning a geometric condition into a boolean (relational) expression. A point (x, y) lies within a circle of radius 10 centred at the origin when its distance from the centre is at most 10. Squaring both sides of distance <= 10 avoids the square root entirely:
x**2 + y**2 <= 100
This expression evaluates to a bool — exactly what the question asks for. Checking it for each dart:
for (x, y) in [(0, 0), (10, 10), (6, 6), (7, 8)]:
print((x, y), x**2 + y**2 <= 100)
| Part | (x, y) | x² + y² | Compared with 100 | Value |
|---|---|---|---|---|
| a | (0, 0) | 0 + 0 = 0 | 0 <= 100 | True (dead centre — a bullseye) |
| b | (10, 10) | 100 + 100 = 200 | 200 <= 100 | False |
| c | (6, 6) | 36 + 36 = 72 | 72 <= 100 | True |
| d | (7, 8) | 49 + 64 = 113 | 113 <= 100 | False |
Expected output:
(0, 0) True
(10, 10) False
(6, 6) True
(7, 8) False
``` …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.