def print_numbers(n): i=0 while i<n: print i i=i+1 print_numbers(80+1) print print # Define a procedure, factorial, that # takes one number as its input # and returns the factorial of # that number. def factorial(n): i=n F=i # print F while i > 1: i=i-1 F=F*i # print i # print F return F print factorial(4) #>>> 24 print factorial(5) #>>> 120 print factorial(6) #>>> 720
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