Python simple Code

sohcahtoa82 at sohcahtoa82 at
Mon Jan 26 19:13:34 CET 2015

On Saturday, January 24, 2015 at 4:16:27 PM UTC-8, 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()

Your English is a bit rough, but from what I'm understanding, the output you're TRYING to get is:


If that's the case, then why do you have functions using factorials?  It sounds like you really have no idea what you're doing and just blindly copied some other code with zero understanding of it.

More information about the Python-list mailing list