Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please I need help with this project in python 3 language Thank you 110 Project 1 (Straight-line Programs) Swami Iyer Problem 6. (Snell's Lase) Snell's

image text in transcribed
image text in transcribed
Please I need help with this project in python 3 language
Thank you
110 Project 1 (Straight-line Programs) Swami Iyer Problem 6. (Snell's Lase) Snell's law states that the ratio of the sines of the angles of incidence and refraction is equivalent to the reclprocal of the ratio of the indices of refraction, ie, sin(1) 2 sin(02) Write a progran taall.py that takes three floats 1 (in degrees), ni and n2 as command-line arguments and writes cotresponding angle of refraction 82 in degrees 8 python3 nell.P 581 1.52 33.91251399826899 Problem 7. (Gambler's Ruin) Consider a coin-flipping game with two players where player one wins each toss with prob ability p, and player two wins with probability-1-P. Suppose player one has ng pennies and player two ng Amining an unfair coin (ie, p #1/2), the probabilities n and P, that players one and two, respectively, will end peniles Wite a program eabier p that takes two integers n and na and a oat p as commad-line arguments and writes the probablities Pi and Pa, separated by a space. Pythos3 gaabler , Py 10 100 o.61 0.6661883734200454 0.333811 6245799349 Problem 8. (Waiting Time) If X is the waiting time betwen now and the next event, the probablity that X s greater than t is given by the exponential distribution where the rate parameter is the average number of events per unit of time white a program withe-m that floats A and t as command-line arguments and writes the probability P(X > t) Python3 waiting,tise.py 0.1 & 0.6068306597126334 Problem 9. (Dhe Rold) Wite a program die-rai.pn that takes an iteger n repesenting the mumber of sides of a fair die, rolls an (n-sided) die twice, and writes the sum of the numbers rolled s pythons die roll.pT Problem 10. (Three Sort) Write a program three.sort py that takes three integers as command-line arguments and writes them in ascending order, separated by spaces. Your solution must only use functions sia) andx Python3 thr..-..rt.py 3 1 2 1 2 3 Project 1 (Stralght-line Programs) Swami lyer ytk that takes three integers m (for month), d (for day), andy writes the day of the week (0 for Sunday, I for Monday, and so on) D, ealeulated (for year) as command-line arguments and a V-(14-m)/12, - m +12 x ((14-m)/12)-2 D (d+o +31 x m/12) mod 7 rrhea3 day.of.weekP 314 1979 Problem 2. (Mercator Projection) The Mereator projection is a conformal (sngle preerving) projection that mape latitude , and lagt de to rectang lar co ordinates z.) it is ly -frexample, in nautical darts and in the maps that projection, with the oenter of map set to the prime meridian (0'), is defined by the equations write a program Mreater.py that takes two floats y values, separated by a space # pythoaa nereater.py 71.06 and as eeeamand-line arguments and writes the corresponding and 2.36-71.06 41519422712 Problem 3. (Great Cirele Distance) Write a program gat inc that takes four losts zi. n. 2, and ya the latitude and longitude in degrees of two points on earth as coenmand-line arguments and writes the great-circle distance in km) between them, given by the equation pythoa) greas esrels.p 48.87-2.33 37, -122.4 389543238289 Problem 4. (Wind Chiut) Given the tetmperature t (in Fahrenbelt) and the wind speed o (in miles per hour), the National Weather Service defines the effective temperature (the wind chill) to be 35.74 +0.62156+(0.4275t- 35,75)e16 Write a program vind chaill.pp that takoms two floats t and ns command-line arguments and writes the wind chill. 21.688989083202 Problem 5. (Gravitational Force) Write program gravstational fore.py that takee floats my and m masses (in kg) of two objeets and a float r representing the distance (in m) between their centers as command-line arguments and writes the gravitational force F (in N) acting between the objects, caleulated as repeesenting the rs g where G-6674 xurn (in ms kri S-1) 1. the gravitational oorstan. s pythood gravisatsonal,feree.p 2e30 624 1.61 3.5594666666668864 +22 1 of 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Can workers be trained in ethics? How? Defend your answer.

Answered: 1 week ago