Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'false.': 0.07; 'subject:Question': 0.07; 'iterate': 0.09; 'clause.': 0.16; 'escribi\xf3:': 0.16; 'from:addr:ricaraoz': 0.16; 'from:name:ricardo ar\xe1oz': 0.16; 'indent': 0.16; 'string': 0.17; 'all,': 0.21; 'trying': 0.21; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'thanks!': 0.26; 'checking': 0.27; 'piece': 0.29; 'character': 0.29; 'included': 0.29; "i'm": 0.29; 'code': 0.31; "aren't": 0.33; 'to:addr:python- list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'false': 0.35; 'returning': 0.35; 'doing': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'list.': 0.35; 'message-id:@gmail.com': 0.36; 'characters': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'below,': 0.60; 'first': 0.61 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=vHeiCb/UrYyPl267hzBvqPzRJgFXIBXV//yx4CDfoyM=; b=cUJBRGt+dXtyiG9ZHq/JL60Me9mL6MLVFBUvyCI/PXmR3CPrwfZm/8useKjLtq6zb1 NznAcMFh80FryVEm47+vrcLZWnnBxHrs2wuOjg9T6I0rEl4JbEW0oKU+SBdh1PiFiL35 4UDBOUgIXj5K3HuPMlMc0xYw20AoidFRkI9yWR3SyiCNR42iq8sLvPGPAIhiZsJrdQ1z 5v9xZkEHOhN5/URbGenHL2mXxCzjgwG1vlWEhQUiIBuUJAXQRal8s2oBz6OkK63eG7r5 UlRmYdYldLk9jnCR8sA+DP2tdT2QI1mDU5C0B1oQNAfOMUP2G5ZOqphgafUA1lGSkMaz nWVQ== X-Received: by 10.236.112.197 with SMTP id y45mr14093575yhg.121.1362403333053; Mon, 04 Mar 2013 05:22:13 -0800 (PST) Date: Mon, 04 Mar 2013 10:21:42 -0300 From: =?ISO-8859-1?Q?Ricardo_Ar=E1oz?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Question on for loop References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362417535 news.xs4all.nl 6935 [2001:888:2000:d::a6]:33279 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40467 El 04/03/13 09:18, newtopython escribió: > Hi all, > > I'm super new to python, just fyi. > > In the piece of code below, secretWord is a string and lettersGuessed is a list. I'm trying to find out if ALL the characters of secretWord are included in lettersGuessed, even if there are additional values in the lettersGuessed list that aren't in secretWord. > > What this code is doing is only checking the first character of secretWord and then returning True or False. How do I get it to iterate through ALL of the characters of secretWord? > > for character in secretWord: > if character not in lettersGuessed: > return True > return False > > Thanks! > > Ro Indent the "return True" line so that it is inside the if clause.