Question

In: Computer Science

using Python The value of the expression that evaluates whether the length of the above hypotenuse...

using Python

  1. The value of the expression that evaluates whether the length of the above hypotenuse is 5
  2. The area of a disk of radius a
  3. The value of the Boolean expression that checks whether a point with coordinates x and y is inside a circle with center (a, b) and radius r

Solutions

Expert Solution

Code:

import math
h=int(input("Enter length of Hypotenuse:"))
if(h==5):   #that checks hypotenuse is 5 or not
    print("yes,above hypotenuse is 5")
else:
    print("the above hypotenuse is not 5")
print()
a=float(input("enter radius of disk:"));
area=3.14*a*a   #calculates area of disk
area=round(area,2);
print("Area of disk is",area);
print()
a=int(input("enter x coordinate of center of circle:"))
b=int(input("enter y coordinate of center of circle:"))
r=float(input("Enter radius of circle:"))
x=int(input("enter x coordinate of point:"))
y=int(input("enter y coordinate of point:"))
d=(x-a)*(x-a);
g=(y-b)*(y-b);
w=math.sqrt(d+g)
print()
if(w<r):   #checks point is inside or not
    print("point(",x,end="")
    print(",",y,end="")
    print(") is inside the circle")
elif(w==r):
    print("point is on the circle")
else:
    print("point is outside the circle")

Snippet Code:

Output:


Related Solutions

Answer these using VISUAL STUDIOS not CTT or PYTHON 1.Write an expression that evaluates to true...
Answer these using VISUAL STUDIOS not CTT or PYTHON 1.Write an expression that evaluates to true if the value of the integer variable x is divisible (with no remainder) by the integer variable y. (Assume that y is not zero.) 2.Write an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder) by the integer variable numberOfParticipants. (Assume that numberOfParticipants is not zero.) 3.Write an expression that evaluates to true if the...
Write class Hypotenuse that calculates the length of the hypotenuse of a right triangle and return...
Write class Hypotenuse that calculates the length of the hypotenuse of a right triangle and return to HypotenuseTest class. The lengths of the other two sides are given by the user by using HypotenuseTest class and send into Hypotenuse class. Hypotenuse class should take two arguments of type double and return the hypotenuse as a double into HypotenuseTest’s Main method. Finally, the HypotenuseTest class displays the hypotenuse side of a triangle.
What is the length of the hypotenuse in the image below?
What is the length of the hypotenuse in the image below? Round your answer to 1 decimal place, units not required.
Write an ASM program that evaluates the following expression, using variables: Z = (-A - B)...
Write an ASM program that evaluates the following expression, using variables: Z = (-A - B) - (-C - D) 1. Declare and initialize the memory variable A to 32-bit signed integer value 543210 and variable B to 16-bit signed integer value -3210. 2. Declare the memory variables C and D and read in their values from the keyboard as 32-bit signed integer value 43210 and 8-bit signed integer values -10, respectively. a. You should display a message asking for...
Write an ASM program that evaluates the following expression, using variables: Z = (-A - B)...
Write an ASM program that evaluates the following expression, using variables: Z = (-A - B) - (-C - D) 1. Declare and initialize the memory variable A to 32-bit signed integer value 543210 and variable B to 16-bit signed integer value -3210. 2. Declare the memory variables C and D and read in their values from the keyboard as 32-bit signed integer value 43210 and 8-bit signed integer values -10, respectively. a. You should display a message asking for...
Evaluate the following logical expression. Choose True if the expression evaluates to true; choose False if...
Evaluate the following logical expression. Choose True if the expression evaluates to true; choose False if the expression evaluates to false. (3 * 5 > 10) || (20 < 15) True False Evaluate the following logical expression. Choose True if the expression evaluates to true; choose False if the expression evaluates to false. "Medium" < "High" True False Evaluate the following logical expression. Choose True if the expression evaluates to true; choose False if the expression evaluates to false. (4...
Find the lengths of the arms of a right triangle whose hypotenuse has length c if...
Find the lengths of the arms of a right triangle whose hypotenuse has length c if these arms have a ratio of (a) 3;4 and c=15, (b) 5;12 and c=26, (c) 8;15 and c =170 and (d) 1;2 and c=10
Python 1) Show the result of evaluating each expression. Be sure that the value is in...
Python 1) Show the result of evaluating each expression. Be sure that the value is in the proper form to indicate its type (int or float). If the expression is illegal, explain why. a) 4.0/10.0 + 3.5 *2 b)10%4 + 6/2 c)abs(4-20//3)**3 d) sqrt(4.5-5.0) + 7*3 e) 3*10//3 + 10%3 f) 3**3 2) Show the sequence of numbers that would be generated by each of the following range experssions. a) range(5) b) range(3,10) c)range (4, 13, 3) d)range (15, 5,...
: In this assignment you will write a C++ program that evaluates an arithmetic expression (represented...
: In this assignment you will write a C++ program that evaluates an arithmetic expression (represented with an infix notation), then outputs this expression in prefix form and also outputs the result of the calculation. The program will first convert the input infix expression to a prefix expression (using the Stack ADT) and then calculate the result (again, using the Stack ADT). The details are provided in the following sections.
Related rates Part A: 1. Consider a right triangle with hypotenuse of (fixed) length 46 cm...
Related rates Part A: 1. Consider a right triangle with hypotenuse of (fixed) length 46 cm and variable legs of lengths x and y, respectively. If the leg of length x increases at the rate of 6 cm/min, at what rate is y changing when x = 5 cm? (Round your answer to three decimal places.) 2. Water is flowing into a vertical cylindrical tank of diameter 8 m at the rate of 5 m3/min. Find the rate at which...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT