* [Python] [26] [experimental demo includes exercises using a recursive method] []

Original title:

Recursive method request 5!

 

The original title given answers:

# ! / Usr / bin / Python 
# encoding = UTF. 8- 
# - * - Coding: UTF-. 8 - * - 

#   recursive method of seeking. 5! 

DEF FACT (J):
     IF J == 0: 
        SUM =. 1
     the else : 
        SUM = J * FACT (. 1-J )
         Print (SUM)
     return SUM 

Print (FACT (. 5))

 

 

 


-------- (I am dividing line) --------

reference:

1. RUNOOB.COM:https://www.runoob.com/python/python-exercise-example26.html

 

 

Remarks:

Initial modified: October 4, 2019 10:25:06

Environment: Windows 7 / Python 3.7.2

 

Guess you like

Origin www.cnblogs.com/kaixin2018/p/11621560.html