def greeting print(Hello world!"*3) def volume_sphere(radius): pi=3.141592653589 volume=(4/3)*pi*radius**3 print("The volume is,volume") volume_sphere(10) #Function that prints the result def sum_print(a,b): result=a+b #Function that reterns results def sum_return(a,b): result=a+b return(result) #This prints the sum of 4+4 sum_print(4,4) #This does not Sum_turn(4,4) #This will not set x1 to the sum #It actually gets a value of'None' x1=sum_print(4,4) #This will x2=sum_return(4,4)
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