Question

Implement a program that requests the user to enter the x and y coordinates (each between -10 and 10) of a dart and computes whether the dart has hit the dartboard, a circle with center (0; 0) and radius 8. If so, string It is in! should be printed on the screen.

>>>
Enter x: 2.5
Enter y: 4
It is in!

Solution

Verified
Answered 2 years ago
Answered 2 years ago
Step 1
1 of 2

Because it's not defined whether the input will be an

integer or a float value, it's not possible to use the int()\textit{int()}

function, but we can use the float()\textit{float()} function instead of eval()\textit{eval()}.

x = eval(input("Enter x: ")) y = eval(input("Enter y: "))

if x2 + y2 < 8**2: print("It is in!")

Create an account to view solutions

By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Continue with GoogleContinue with Facebook

Create an account to view solutions

By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Continue with GoogleContinue with Facebook

More related questions

1/4

1/7