Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84687

Re: Python simple Code

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'skip:[ 20': 0.04; 'output': 0.05; 'subject:Python': 0.06; 'jan': 0.12; 'itertools': 0.16; 'subject:simple': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'import': 0.22; 'subject:Code': 0.24; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'but': 0.35; 'received:google.com': 0.35; 'expected': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'simple': 0.61; '2015': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=DqgY8W9sehAGC07TS+WvGe9c7iVX2dbt0NAmwDooN08=; b=IC2BrgrNZ8E2rhMmh9NrC01e8s2D4y7xS9/i4RzyaJowwAcL0tes+CZgPCVEwOc1sd medOdEBDZed2fhC/AzBvGK9uuW4c9Sepg6ttI89w9ddxCLV9eT0vTqAw9Q2v+0BO6iMT CBX3G1hqwZrWvVdytGZ8seethQYMeafiJ4gcf7GP172d/3S74fwzirA3XZBstiuPyr2h E888CD+taKbt3zLvXKBr7UAnaW6UnkyW66NUJi+zaIArlWUif07UWlHsUWKRWR6zvKpE YN38n+vMSfVhhEYKiqioDrbeD6g+0GjzHJhVBtjSpWWKiyCMh0MsXgJkXmOjI6Jwa0ub 12BA==
X-Received by 10.67.13.12 with SMTP id eu12mr654864pad.157.1422402654369; Tue, 27 Jan 2015 15:50:54 -0800 (PST)
MIME-Version 1.0
In-Reply-To <0514aac8-943b-4ecc-9ebb-91dd9b58c0f1@googlegroups.com>
References <4e283f62-0b6a-4ef7-a784-b9b3da73f510@googlegroups.com> <0514aac8-943b-4ecc-9ebb-91dd9b58c0f1@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 27 Jan 2015 16:50:14 -0700
Subject Re: Python simple Code
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.18194.1422402657.18130.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1422402657 news.xs4all.nl 2832 [2001:888:2000:d::a6]:44361
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84687

Show key headers only | View raw


On Tue, Jan 27, 2015 at 4:22 PM, Salem Alqahtani <salem055@gmail.com> wrote:
> I appreciate your answers and the output that I am expected from my simple code is the following:
>
> ['salem','Ali','sultan']
> ['salem','sultan','Ali']
> ['Ali','sultan','salem']
> ['Ali','salem','sultan']
> ['sultan','Ali','salem']
> ['sultan','salem','sultan']
>
> the 3 * 2 * 1 is 6 but I do not looking for this output.

>>> from itertools import permutations
>>> a = ['salem', 'Ali', 'sultan']
>>> for p in permutations(a):
...   print(list(p))
...
['salem', 'Ali', 'sultan']
['salem', 'sultan', 'Ali']
['Ali', 'salem', 'sultan']
['Ali', 'sultan', 'salem']
['sultan', 'salem', 'Ali']
['sultan', 'Ali', 'salem']

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Python simple Code Salem Alqahtani <salem055@gmail.com> - 2015-01-24 16:16 -0800
  Re: Python simple Code Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-25 00:38 +0000
    Re: Python simple Code Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-26 19:26 -0800
  Re: Python simple Code Terry Reedy <tjreedy@udel.edu> - 2015-01-24 20:15 -0500
  Re: Python simple Code sohcahtoa82@gmail.com - 2015-01-26 10:13 -0800
  Re: Python simple Code Salem Alqahtani <salem055@gmail.com> - 2015-01-27 15:22 -0800
    Re: Python simple Code Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-27 16:50 -0700
      Re: Python simple Code Salem Alqahtani <salem055@gmail.com> - 2015-01-27 17:35 -0800
    Re: Python simple Code Denis McMahon <denismfmcmahon@gmail.com> - 2015-01-28 03:15 +0000

csiph-web