Ask Question
29 August, 12:49

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.

+4
Answers (1)
  1. 29 August, 15:56
    0
    Following are the program in the Python Programming Language.

    #import math package

    from math import sqrt

    #define function

    def circle (x, y):

    #return the square root

    return sqrt ((x) * *2 + (y) * *2)

    #get input from the user

    x = float (input ("Enter first number between - 10 and 10: "))

    #get input from the user

    y = float (input ("Enter first number between - 10 and 10: "))

    #check condition

    if (circle (x, y) <8):

    #then, print message

    print ("It is in!")

    #otherwise

    else:

    #print message

    print ("It is not in!")

    Output:

    Enter first number between - 10 and 10: 1.5

    Enter first number between - 10 and 10: 2.6

    It is in!

    Explanation:

    Here, in the following program in the Python Programming Language.

    Define the function "circle" and pass the argument "x" and "y" then, return square root of x and y. Set a variable "x" which get float type input from the user. Set a variable "y" which get float type input from the user. Set the if conditional statement to check that the function return the value less than 8 then, print the message. Otherwise, it print the following message.
Know the Answer?
Not Sure About the Answer?
Get an answer to your 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 ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers