Question

Given the following coordinates: (f, 9), (z, 2), (t, 4), (x, 8), (b, 1), (m, 7)....

Given the following coordinates: (f, 9), (z, 2), (t, 4), (x, 8), (b, 1), (m, 7).

Sort the coordinates in Python (in ascending order) by comparing the second part of the coordinates. You may use the sort() function in Python.

Homework Answers

Answer #1

Python code:

# Sort the coordinates in Python (in ascending order) by comparing the second part of the coordinates.
# Using the sort() function in Python.

def last(n):
   return n[m]

# function to sort
def sort(tuples):
   return sorted(tuples, key = last)

# driver code
coordinates = [('z', 9), ('z', 2), ('t', 4), ('x', 8), ('b', 1), ('m', 7)]
m = 1 #key position
print("Sorted:"),
print(sort(coordinates))

Output:


Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]...
Given the following unordered array: [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] W X D T P N R Q K M E If the array was being sorted using the SHELL sort and the halving method, and sorting into ASCENDING order as demonstrated in the course content, list the letters in the resulting array, in order AFTER the FIRST pass. [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
x f 10 3 9 6 8 4 7 5 6 2 Find the Z score...
x f 10 3 9 6 8 4 7 5 6 2 Find the Z score when X = 9, for the for the following Data
X F 10 3 9 6 8 4 7 5 6 2 Find the Z score...
X F 10 3 9 6 8 4 7 5 6 2 Find the Z score when X = 9, for the for the following Data I like to have my calculations include up to the 3rd place after the decimal.
Match each equation with its name. (calculus 3) (x/7)^2-(y/9)^2=z/4 (x/7)^2-y/9+(z/4)^2=0 −x/7+(y/9)^2+(z/4)^2=0 (x/7)^2+(y/9)^2=(z/4)^2 (x/7)^2+(y/7)^2+(z/7)^2=1 Hyperbolic paraboloid Elliptic...
Match each equation with its name. (calculus 3) (x/7)^2-(y/9)^2=z/4 (x/7)^2-y/9+(z/4)^2=0 −x/7+(y/9)^2+(z/4)^2=0 (x/7)^2+(y/9)^2=(z/4)^2 (x/7)^2+(y/7)^2+(z/7)^2=1 Hyperbolic paraboloid Elliptic paraboloid on x axis Cone on z axis Elliptic paraboloid on y axis Sphere
1. Find f''(x) F(x)= (x^2+2)^9 F''(x)= 2. Find t^(4)(n) for the function t(n)= 2n^-1/2+7n^3/2 t^(4)(n) =...
1. Find f''(x) F(x)= (x^2+2)^9 F''(x)= 2. Find t^(4)(n) for the function t(n)= 2n^-1/2+7n^3/2 t^(4)(n) = (Type an expression using n as the variable. Simplify your answer)
Question 4: (20 marks) Given the following numbers found in an array: 8, 7, 1, 4,...
Question 4: Given the following numbers found in an array: 8, 7, 1, 4, 3, 9 Use insertion sort to sort the original list of numbers. Use bubble sort to sort the original list of numbers.   
1. f(x, y, z) = 2x-1 − 3xyz2 + 2z/ x4 2. f(s, t) = e-bst...
1. f(x, y, z) = 2x-1 − 3xyz2 + 2z/ x4 2. f(s, t) = e-bst − a ln(s/t) {NOTE: it is -bst2 } Find the first and second order partial derivatives for question 1 and 2. 3. Let z = 4exy − 4/y and  x = 2t3 , y = 8/t Find dz/dt using the chain rule for question 3.
1. If f(x) = ∫10/x t^3 dt then: f′(x)= ? and f′(6)= ? 2. If f(x)=∫x^2/1...
1. If f(x) = ∫10/x t^3 dt then: f′(x)= ? and f′(6)= ? 2. If f(x)=∫x^2/1 t^3dt t then f′(x)= ? 3. If f(x)=∫x3/−4 sqrt(t^2+2)dt then f′(x)= ? 4. Use part I of the Fundamental Theorem of Calculus to find the derivative of h(x)=∫sin(x)/−2 (cos(t^3)+t)dt. what is h′(x)= ? 5. Find the derivative of the following function: F(x)=∫1/sqrt(x) s^2/ (1+ 5s^4) ds using the appropriate form of the Fundamental Theorem of Calculus. F′(x)= ? 6. Find the definitive integral: ∫8/5...
1. Let f(x)=−x^2+13x+4 a.Find the derivative f '(x) b. Find f '(−3) 2. Let f(x)=2x^2−4x+7/5x^2+5x−9, evaluate...
1. Let f(x)=−x^2+13x+4 a.Find the derivative f '(x) b. Find f '(−3) 2. Let f(x)=2x^2−4x+7/5x^2+5x−9, evaluate f '(x) at x=3 rounded to 2 decimal places. f '(3)= 3. Let f(x)=(x^3+4x+2)(160−5x) find f ′(x). f '(x)= 4. Find the derivative of the function f(x)=√x−5/x^4 f '(x)= 5. Find the derivative of the function f(x)=2x−5/3x−3 f '(x)= 6. Find the derivative of the function g(x)=(x^4−5x^2+5x+4)(x^3−4x^2−1). You do not have to simplify your answer. g '(x)= 7. Let f(x)=(−x^2+x+3)^5 a. Find the derivative....
Find equations of the following. 2(x − 8)2 + (y − 9)2 + (z − 1)2...
Find equations of the following. 2(x − 8)2 + (y − 9)2 + (z − 1)2 = 10,    (9, 11, 3) (a) the tangent plane (b) the normal line (x(t), y(t), z(t))
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT