# --------------------------------------------------- # # How much to increase cooking time at high altitudes # #---------------------------------------------------- # alt = altitude (feet) # t_low = time at sea level (minutes) # t_high = time at current altitude (minutes) # pot_h = instant pot high pressure time at current altitude (minutes) # pot_l = instant pot low pressure time at current altitude (minutes) # (%*time)=0.005*atm-10 3000 to 15,000 # (%*time)=(1.666667*10**-3)*atm 0 to 3000 import math def checkno(): try: x = raw_input(ques) float(x) return(x); except ValueError: print 'This is not a number, try again' print print x = checkno() return(x); print print alt = 0 t_low = 0 t_high = 0 pot_h = 0 pot_l = 0 ques = 'Enter current altitude (feet): ' x = alt x = checkno() alt = x alt = float(alt) ques = 'Enter sea level cooking time (minutes): ' x = t_low x = checkno() t_low = x t_low = float(t_low) j = 'n' while (j <> 'y'): # t_high = ((0.0048*alt/100)+1)*t_low t_high = ((1.00016*10**-4)*alt+1.00021)*t_low if alt < 3000: pot_h=((0.0016667*alt/100)+1)*t_low elif alt >= 3000: pot_h=(((0.005*alt-10)/100)+1)*t_low pot_l = (t_high+pot_h)/2 print print print 'Cooking time at current altitude = ', "%.1f" % t_high, 'minutes' print print 'Cooking time in Instant Pot' print ' Low pressure setting = ', "%.1f" % pot_l, 'minutes' print ' High pressure setting= ', "%.1f" % pot_h, 'minutes' print print print 'To end the program press y then enter' print 'Else to run again just press enter' print j = raw_input() if j == 'y': print exit() ques = 'Enter current altitude (feet): ' x = alt x = checkno() alt = x alt = float(alt) ques = 'Enter sea level cooking time (minutes): ' x = t_low x = checkno() t_low = x t_low = float(t_low)
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