print '------------------' # table heading F = 0 # start value for C dF = 10 # increment of C in loop while F <= 100: # loop heading with condition C = (5.0/9)*(F - 32) # 1st statement inside loop Ca = (F - 30)/2 print '%5.1f %5.1f %5.1f' % (F, C, Ca) # 2nd statement inside loop F = F + dF # 3rd statement inside loop print '------------------' # end of table line (after loop) ''' Sample run: ------------------ 0.0 -17.8 -15.0 10.0 -12.2 -10.0 20.0 -6.7 -5.0 30.0 -1.1 0.0 40.0 4.4 5.0 50.0 10.0 10.0 60.0 15.6 15.0 70.0 21.1 20.0 80.0 26.7 25.0 90.0 32.2 30.0 100.0 37.8 35.0 ------------------ '''
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