Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'else:': 0.03; 'output': 0.05; 'subject:Python': 0.06; 'sys': 0.07; 'main()': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; 'wrote': 0.14; '2.7': 0.14; 'editor,': 0.16; 'guys,': 0.16; 'main():': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:simple': 0.16; 'wrote:': 0.18; 'result.': 0.19; '>>>': 0.22; 'import': 0.22; 'print': 0.22; 'header:User- Agent:1': 0.23; 'subject:Code': 0.24; 'question': 0.24; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'array': 0.29; 'code': 0.31; 'run': 0.32; 'but': 0.35; 'idle': 0.36; 'joined': 0.36; 'list': 0.37; 'expected': 0.38; 'to:addr:python- list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'hope': 0.61; 'sincerely': 0.63; 'choose': 0.64; 'provide': 0.64; 'received:fios.verizon.net': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Python simple Code Date: Sat, 24 Jan 2015 20:15:56 -0500 References: <4e283f62-0b6a-4ef7-a784-b9b3da73f510@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: <4e283f62-0b6a-4ef7-a784-b9b3da73f510@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1422148807 news.xs4all.nl 2959 [2001:888:2000:d::a6]:39295 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:84536 On 1/24/2015 7:16 PM, Salem Alqahtani wrote: > Hi Guys, > > I just joined the group and I hope that I can help and be active. > > I have a question about python. I wrote a code on python 2.7 and I want to choose from the list of names that I provide n!. I execute the code but the result or output is the numbers. I want the people names are the result. > > > Sincerely > > import sys > import array > a=['salem','Ali','sultan'] > m = len(a) > def Factorials(m): > if m == 0: > return 1 > else: > print m > return m * Factorials(m-1) > def output(): > print a > def main(): > print Factorials(m) > output() > main() When I copy, paste, and run this in Idle editor, I get the expected >>> 3 2 1 6 ['salem', 'Ali', 'sultan'] -- Terry Jan Reedy