Added factorial test case
[official-gcc.git] / gcc / testsuite / python.dg / t_recursion_1.py
blobedc95b1f9eaa51ca4bd4813e53ef9c9a50b1619d
1 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 # Version 2, December 2004
4 # Copyright (C) 2004 Sam Hocevar
6 # Everyone is permitted to copy and distribute verbatim or modified
7 # copies of this license document, and changing it is allowed as long
8 # as the name is changed.
10 # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
13 # 0. You just DO WHAT THE FUCK YOU WANT TO.
16 # @Author windigo - jacob@fragdev.com
17 # @Date 30/8/10
18 # @Expected Result: <120>
19 # -Tested against Python Version <2.6.5>
21 def factorial ( x ):
22 if x > 1:
23 return x * factorial ( x - 1 )
24 else:
25 return 1
27 print factorial( 5 )