Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.037 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'else:': 0.03; 'skip:[ 20': 0.03; 'cc:addr:python-list': 0.10; 'googling': 0.16; 'loops': 0.16; 'syntax.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'basically': 0.17; 'element': 0.17; '(or': 0.18; 'email addr:gmail.com>': 0.20; 'cc:2**0': 0.23; 'script': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'sets.': 0.29; 'url:mailman': 0.29; 'skip:& 10': 0.29; "i'm": 0.29; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'equal': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'clear': 0.35; 'pm,': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'test': 0.36; 'thank': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'url:mail': 0.40; 'your': 0.60; 'back': 0.62; 'more': 0.63; 'here': 0.65; 'legal': 0.65; '20,': 0.65; '2013': 0.84; 'subject:Test': 0.84; 'ana': 0.91; 'joel': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=7QtrUFMpfhLxZsV2R6UbRktwuyGU2+lNB/fl7yDPbts=; b=RGdvx0p/q19sbeop5q19ul9XKVwiy4lt93KljpA5HwSByhscFppx9a2872xBNE0gf6 bita5KfP0JpUIyj2mkzk9nBXzWa8Ijoa0aqZLSyT95iVPGp9fnA72BcNPhgavYOMFWK7 mVMg2pFwz54Ek5zZiwLKx5D5ibLyn60CChII/LIXUTRRK9rSuurz6zuzja/b/S9mK0I0 Arb8cxdy9vEHNA44EeJ2QF5Tk+gi9eIgffoBiNHd2n8rT9Uwp4sb0mTXGPSHagUTIeV5 tlwhfqt6b6Ke+svIA0qWf/vx7DuK2ZSCuUh/KFfNVIIZCNpWzQMSDA9+MQx28ctd3k2h Vwpg== MIME-Version: 1.0 X-Received: by 10.220.153.143 with SMTP id k15mr9297507vcw.33.1363804003228; Wed, 20 Mar 2013 11:26:43 -0700 (PDT) In-Reply-To: <121be20a-c02a-4b0e-a86f-7c69597b9296@googlegroups.com> References: <121be20a-c02a-4b0e-a86f-7c69597b9296@googlegroups.com> Date: Wed, 20 Mar 2013 14:26:42 -0400 Subject: Re: Test a list From: Joel Goldstick To: =?UTF-8?Q?Ana_Dion=C3=ADsio?= Content-Type: multipart/alternative; boundary=f46d043d677127e7d404d85f5d53 Cc: "python-list@python.org" 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: 98 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363804006 news.xs4all.nl 6892 [2001:888:2000:d::a6]:38009 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41612 --f46d043d677127e7d404d85f5d53 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Mar 20, 2013 at 2:15 PM, Ana Dion=C3=ADsio wrote: > > t=3D [3,5,6,7,10,14,17,21] > > Basically I want to print Test 1 when i is equal to an element of the lis= t > "t" and print Test 2 when i is not equal: > > > while i<=3D25: > You test i, but you don't set i to anything, or change it in your loop you may want to try for i in range(25) (or perhaps range(1,26) i'm guessing. Be more clear > > if i=3D=3Dt[]: > This isn't legal syntax. Try googling about for loops and sets. Try again and come back > > print "Test1" > > else: > > print "Test2" > > What is missing here for this script work? > > Thank you all > -- > http://mail.python.org/mailman/listinfo/python-list > --=20 Joel Goldstick http://joelgoldstick.com --f46d043d677127e7d404d85f5d53 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Wed, Mar 20, 2013 at 2:15 PM, Ana Dion=C3=ADsio <anadion= isio257@gmail.com> wrote:

t=3D [3,5,6,7,10,14,17,21]

Basically I want to print Test 1 when i is equal to an element of the list = "t" and print Test 2 when i is not equal:


while i<=3D25:

You test i, but you d= on't set i to anything, or change it in your loop

you= may want to try

=C2=A0 for i in range(25)=C2=A0 (or perh= aps range(1,26)=C2=A0 i'm guessing.=C2=A0 Be more clear

=C2=A0 =C2=A0 if i=3D=3Dt[]:

This isn&#= 39;t legal syntax.=C2=A0 Try googling about for loops and sets.=C2=A0 Try a= gain and come back

=C2=A0 =C2=A0 =C2=A0 =C2=A0print "Test1"

=C2=A0 =C2=A0 else:

=C2=A0 =C2=A0 =C2=A0 =C2=A0print "Test2"

What is missing here for this script work?

Thank you all
--
http://mail.python.org/mailman/listinfo/python-list



--
--f46d043d677127e7d404d85f5d53--