A dartboard of radius 10 and the wall it is hanging on are represented using the twodimensional coordinate system, with the board’s center at coordinate (0,0). Variables x and y store the x- and y-coordinate of a dart hit. Write an expression using variables x and y that evaluates to True if the dart hits (is within) the dartboard, and evaluate the expression for these dart coordinates:

Respuesta :

Answer:

See Explanation Below

Step-by-step explanation:

Given that radius = 10 and variables x and y store the x- and y-coordinate of the dart.

The expression written in Python Programming Language is as follows.

import math

# Initialise radius to 10

radius = 10

# Accept integer input for x and y

x = int(raw_input("x co-ordinate: "))

y = int(raw_input("y co-ordinate: "))

# Calculate distance

distance = math.sqrt(x*x + y*y)

# Print distance

print(distance)

# Compare distance to radius

if dist<radius:

print("Hit")

else:

print("Miss")

# End of program

Answer:

Refer below for the explanation.

Step-by-step explanation:

//math importing

import math

//initializing radius 10 as per in the question

r= 10

//input for x coordinate

A= int(raw_input("Enter number:"))

//input for y coordinate

B= int(raw_input("Enter number:"))

Distance = math.sqrt(a*a+ b*b)

print Distance

if Distance

print "gain"

else:

print "lost"