Skip to content

Instantly share code, notes, and snippets.

@ecylmz
Created March 11, 2011 08:57
Show Gist options
  • Save ecylmz/865648 to your computer and use it in GitHub Desktop.
Save ecylmz/865648 to your computer and use it in GitHub Desktop.
#!/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