import math #a place to put a bunch of times times = [] #python's for loops are really screwy, but it's still the best way to iterate over a bunch of values for n in range(0,9001): a = float(n)/100 #how many decimal places you want, in this case we'll go out to the hundredth c = 30.0 #constants b = 180 - (a+c) #TASTe! ac = 650.0 bc = (math.sin(math.radians(a))*ac)/math.sin(math.radians(b)) #the law of sines proved very useful here ab = (math.sin(math.radians(c))*ac)/math.sin(math.radians(b)) sandTime = ab/2 pavementTime = bc/5 routeTime = sandTime + pavementTime times.append(routeTime) #let's put this somewhere for safekeeping #wash, rinse, and repeat 9001 times! newTimes = [] #a temporary place newTimes.extend(times) #add in the times newTimes.sort() #in order of smallest to largest place = times.index(newTimes[0]) print(float(place)/100)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question