Created
March 11, 2011 08:57
-
-
Save ecylmz/865648 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import doctest | |
def faktoriyel(sayi): | |
"""\ | |
>>> faktoriyel(6) | |
720 | |
""" | |
if type(sayi)==int and sayi>=0 : | |
if sayi==0 or sayi==1: | |
return 1 | |
else: | |
for i in range(2,sayi): | |
sayi=sayi*i | |
return sayi | |
else: | |
print 'integer türünde pozitif değerler giriniz' | |
doctest.testmod() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment