summaryrefslogtreecommitdiff
path: root/gcc/testsuite/python.dg/t_recursion_1.py
blob: edc95b1f9eaa51ca4bd4813e53ef9c9a50b1619d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
#  Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
#
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this license document, and changing it is allowed as long
# as the name is changed.
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
#
# 0. You just DO WHAT THE FUCK YOU WANT TO.
#

# @Author windigo - jacob@fragdev.com
# @Date 30/8/10
# @Expected Result: <120>
#   -Tested against Python Version <2.6.5>

def factorial ( x ):
    if x > 1:
        return x * factorial ( x - 1 )
    else:
        return 1

print factorial( 5 )