# this is a comment answer = 42 radius_of_earth = 6.371e6 # m a = 3 * answer + 4 b = radius_of_earth ** 2 + (a + 3) ** 0.5 answer +=7 # note that python does integer arithmetic unless you specify a floating point number c = 5 / 4 d = 5 / 4. e = 1.0 * 5 / 4 print a, b, answer, c, d, e import math f = math.sqrt(4) # 4 ** 0.5 g = radius_of_earth * math.sin(math.pi / 180 * 23.4) print f, g for h in range(7): i = h**2 print i
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