def f(x,y): r = x**2+y**2 return r if __name__=="__main__": print "hello world" r = f(3,5) print r def new_line(): print print "First Line." new_line() print "Second Line." def three_lines(): new_line() new_line() new_line() print "First Line." three_lines() print "Second Line." def new_line(): print def three_lines(): new_line() new_line() new_line() print "First Line." three_lines() print "Second Line." print abs(5) print abs(-5) print pow(2, 3) print pow(7, 4) print max(7, 11) print max(4, 1, 17, 2, 12) print max(3 * 11, 5**3, 512 - 9, 1024**0) def print_twice(param): print param, param print_twice('Spam') print_twice(5) print_twice(3.14159) def cat_twice(part1, part2): cat = part1 + part2 print_twice(cat) chant1 = "Pie Jesu domine, " chant2 = "Dona eis requiem." cat_twice(chant1, chant2)
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