# Hello All First Week Of Python Homework The Professor Does Not Speak Very Well E

Hello all, first week of python homework, the professor does not speak very well english at all and I am very

confused. I aced all my other programing courses, I just need help with this weeks homework and ill be able to figure it out. 1) Order check. Compose a program that takes three floats x, y, and z as command-line arguments and writes True if the values are strictly ascending or descending (x < y < z or x > y > z), and False otherwise.

#### How many pages is this assigment?

2) Physics Equation. Compose a program that takes three floats x0, v0, and t from the command line, evaluates x0 + v0t – Gt2 / 2, and writes the result. (Note: G is the constant 9.80665. This value is the displacement in meters after t seconds when an object is thrown straight up from initial position x0 at velocity v0 meters per second.)

3) Continuously compounded interest. Compose a program that calculates and writes the amount of money you would have if you invested it as a given interest rate compounded continuously, taking the number of years t, the principal P, and the annual interest rate r as command-line arguments. The desired value is given by the formula pert.

4) Color conversion. Several different formats are used to represent color. For example, the primary format for LCD displays, digital cameras, and web pages, known as the RGB format, specifies the level of red (R), green (G), and blue (B) on an integer scale from 0 to 255. The primary format for publishing books and magazines, known as the CMYK format, specifies the level of cyan (C), magenta (M), yellow (Y), and black (K) on a real scale from 0.0 to 1.0. Compose a program that converts RGB to CMYK. Accept three integers —r, g, and b —from the command line and write the equivalent CMYK values. If the RGB values are all 0, then the CMY values are all 0 and the K value is 1; otherwise, use these formulas:

w = max(r/255, g/255, b/255) c = (w – r/255) / w m = (w – g/255) / w y = (w – b/255) / w k = 1 – w

Here’s an example run:

\$ python rgbtocmyk.py 75 0 130

cyan = 0.4230769230769229

magenta = 1.0

yellow = 0.0

black = 0.4901960784313726

5) Great circle. Compose a program that takes four float command-line arguments x1, y1, x2, and y2 (the latitude and longitude, in degrees, of two points on the earth) and writes the great-circle distance between them. The great-circle distance d (in nautical miles) is given by the formula derived from the law of cosines:

d = 60 * arccos(sin(x1) * sin(x2) + cos(x1) * cos(x2) * cos(y1 – y2))

Note that this equation uses degrees, whereas Python’s trigonometric functions use radians. Use math.radians() and math.degrees() to convert between the two. Use your program to compute the great-circle distance between Paris (48.87° N, -2.33° W) and San Francisco (37.8° N, 122.4° W), between Leningrad (59.9° N, -30.3° W) and San Francisco (37.8° N, 122.4° W), between Paris (48.87° N, -2.33° W) and Austin (30.27° N, 97.74° W), between Nashville airport (BNA) (36.12° N, -86.67° W) and LAX (33.94° N, -118.4° W),between Princeton (40.35° N, 74.65° W) and Paris (48.87° N, -2.33° W).

Here’s an example run:

Note: the shape of the earth is more like a flattened spheroid than a sphere, so the formula above is only an approximation (up to around 0.5% error). Also, this formula is unreliable for small distances because the inverse cosine function is ill-conditioned.

Here is the Haversine formula: a = sin2((L2-L1)/2) + cos(L1) * cos(L2) * sin2((G2-G1)/2) c = 2 *

arcsin(min(1, sqrt(a)))

# distance in radians distance = 60 * c # nautical miles

The Haversine formula is accurate for most distances, but it suffers from rounding errors when the points are (nearly) antipodal. The following formula is accurate for all distances. delta = G1 – G2 p1 = cos(L2) * sin(delta) p2

= cos(L1) * sin(L2) – sin(L1) * cos(L2) * cos(delta) p3 = sin(L1) * sin(L2) + cos(L1) * cos(L2) * cos(delta) distance = 60 * atan2(sqrt(p1*p1 + p2*p2), p3) This Kahan reference provides more details.

if __name__ == &quot;__main__&quot;: import sys print(sys.argv) # three integers from the command line r = float(sys.argv) b = float(sys.argv) g = float(sys.argv) if r == 0 and b == 0 and…