CODE:
import math
anylist=[[1,1],[2,2],[4,4]] #input list
def shortestDist(anylist):
i=0
j=i+1
z=0
templist=[] #temporary list to store distances
while(z<len(anylist)-1):
sum1=(anylist[i][0]-anylist[j][0] )**2 + (
anylist[i][1]-anylist[j][1] )**2
i=i+1
j=i+1
z=z+1
templist.append(math.sqrt(sum1))
return templist
calling=shortestDist(anylist)
print(min(calling)) # printing minimum distance
This is a python question The distance between 2 points (xi.Vi). (x2.y2) on a plane is...
Recall that the distance between two points (x1, y1) and
(x2, y2) on a Cartesian plane is given by
Write a function to pass the four parameters, compute the
correct distance, and return the results
use python
2a. Union (1 points) Make a union function which takes in 2 lists as parameters and returns a list. It should return a list that contain all elements that are in either list. Your results list should contain no duplicates. For example, if the two lists are [1,5,6,5, 2] and [3,5, 1,9] then the result list is (1,5,6,2,3,9). Note that the list sizes don't have to be equal. Note that the input lists could have duplicates, but your...
Let S denote the sphere x2 y2 2 = 1. Given two points P(1,0,0), (a) Find the distance between P and Q. Lets call this Euclidean distance. (b) Find the plane that goes through O, P, Q. What is the intersection of this plane with the sphere? (Hint: use OP × OQ as the the normal vector) (c) Observe that the length of the arc PQ is 0 the angle between OP,0Q in radians. (Hint: You know how to find...
The distance, d, between two points, (x1,y1)(x1,y1) and (x2,y2)(x2,y2), can be found using the formula d=√(x2−x1)^2+(y2−y1)^2. How can you rearrange the given formula to correctly find y2?
In Python
Question 3 (13 points): Purpose: To practice your ability to modify lists and compute with lists of lists Degree of Difficulty: Moderate For this question, you are given some population estimates, by age group, from Statistics Canada for some provinces. Starter File a5q3 starter.py is a file that contains a list of lists, to which the variable Pop-data refers, which represents 2020 population numbers. The first item in Pop_data is a list whose first item is the string...
I he following formula gives the distance between two points (x1, yl) and (02, y2) in the Cartesian plane The main0 function is provided. You should implement the following functions: sqrt [ (x2-x1), (y2-yl) 1. Fi ndRadius... ): This function takes as its parameter four numbers that represent the center and a point on the circle, finds and returns the circle's radius. 2 CircleCalculations(....: This function takes as its parameter a number that represents the radius of the circle and...
Complete function long_list_printer.print_list(). When it's
finished, it should be able to print this list,
a = [
[93, 80, 99, 72, 86, 84, 85, 41, 69, 31],
[15, 37, 58, 59, 98, 40, 63, 84, 87, 15],
[48, 50, 43, 68, 69, 43, 46, 83, 11, 50],
[52, 49, 87, 77, 39, 21, 84, 13, 27, 82],
[64, 49, 12, 42, 24, 54, 43, 69, 62, 44],
[54, 90, 67, 43, 72, 17, 22, 83, 28, 68],
[18, 12, 10,...
36a and 37
12:41 - A A) a a lies between the points (0,0) and (1,1). If your CAS has trouble evaluating the integral, make a substitution that changes the integral into one that the CAS can evaluate. 33. Sketch the curve with equation x2/3 + y2/3 = 1 and use symmetry to find its length. 34. (a) Sketch the curvey - x (b) Use Formulas 3 and 4 to set up two integrals for the are length from (0,0)...
I really need help with this python programming assignment Program Requirements For part 2, i need the following functions • get floats(): It take a single integer argument and returns a list of floats. where it was something like this def get_floats(n): lst = [] for i in range(1,n+1): val = float(input('Enter float '+str(i)+': ')) lst.append(val) return lst • summer(): This non-void function takes a single list argument, and returns the sum of the list. However, it does not use...
Part 2. Algorithms for Big Data Programming (48 points total for this part) [Question 1, 12 points total, including 1.1 - 1.3] Suppose our input data to a map-reduce operation consists of integer values (that is, the values are integers, note the keys are not important). The map function takes an integer i and produces the list of pairs (1) such that p is a prime divisor of į. For example, map(12) = [(2,12),(3,12)]. The reduce function is addition. That...