Path: csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:test': 0.07; '22,': 0.09; 'answering': 0.09; 'output': 0.13; 'def': 0.13; 'value.': 0.15; "'s')": 0.16; 'dictionaries': 0.16; 'evaluates': 0.16; 'input:': 0.16; 'wrote:': 0.16; 'input': 0.18; '2015': 0.20; 'function,': 0.22; 'sep': 0.22; 'sorry,': 0.22; 'header:In-Reply- To:1': 0.24; "doesn't": 0.26; 'define': 0.27; 'question': 0.27; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'way?': 0.29; "i'm": 0.30; 'print': 0.30; 'code': 0.30; 'tue,': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'propose': 0.35; 'asking': 0.35; "isn't": 0.35; 'skip:p 30': 0.35; 'to:addr:python- list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'really': 0.37; 'two': 0.37; 'mean': 0.38; 'to:addr:python.org': 0.40; 'questions': 0.40; 'provide': 0.61; 'here.': 0.62; 'more': 0.63; 'python-list': 0.66; 'here': 0.66; 'subjectcharset:utf-8': 0.71; 'to:name:python': 0.84; 'subject:you': 0.85 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:content-transfer-encoding; bh=ecQyetOYcXQeKmk42QTB5S7XQ4x+K3aBOqY6gXhvEO8=; b=Q/Jc45ihpUs8OTBI9xK9Odyu+WjrAp2FIbBCA1tMqjBqzDe7dNnGtpekI1dYNadrJE 91ohZzKyXyLmIHRNlnS+LHHIWzlIQW9/f/mTUz/X1vwNVUmifjT3l+N2+AcbIoyPW0DR 7DZnOBDLL5OnGXTauKBaOODj8YWN0dgg93FjRL+yUfQMlaL30y8eFNWIM0NBLTl+bt0y N6EPGYlqNYddAZY47zgZu3PqwnwKnno+4ZHsdGfPAGU0S5Jw5dAwQpvLjW41E+TLRbhs WjT8MDkTcH9aaBqGsuJL48EefWX3OyQxB84KxQCWTlgChKfGm68lE0IDaTqXJ4W+yBwo 75cQ== X-Received: by 10.129.103.67 with SMTP id b64mr22694686ywc.55.1442949290111; Tue, 22 Sep 2015 12:14:50 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <78fc66f6-04f9-4b84-8410-2e74fb75fbb4@googlegroups.com> References: <78fc66f6-04f9-4b84-8410-2e74fb75fbb4@googlegroups.com> From: Ian Kelly Date: Tue, 22 Sep 2015 13:14:10 -0600 Subject: =?UTF-8?Q?Re=3A_A_little_test_for_you_Guys=F0=9F=98=9C?= To: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1442949299 news.xs4all.nl 23849 [2001:888:2000:d::a6]:54835 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96986 On Tue, Sep 22, 2015 at 12:43 PM, Python_Teacher via Python-list wrote: > you have 10 minutes=F0=9F=98=82 Good luck!! Sorry, I'm more interested in critiquing the questions than answering them. > Let's define the function plural : > > def plural(words): > plurals =3D [] > for word in words: > plurals.append(word + 's') > return plurals > > for word in plural(['cabagge','owl','toy']): > print word > > Question : How could the code of the function plural be optimised? Optimized in what way? To be faster? Use less memory? Be more readable? > 3 Dictionaries > > Here are two dictionnaries : > > input =3D { > 'foo1': 'bar1', > 'chose': 'truc', > 'foo2': 'bar2', > } > output =3D { > 'bar1': 'foo1', > 'truc': 'chose', > 'bar2': 'foo2' > } > > Question : Propose a function that returns output when you provide input = ? def f(maybe_input): if maybe_input =3D=3D input: return output I don't think I really understand what it is that you're asking for here. > 3. What is the return value of hello.__doc__ hello.__doc__ isn't a function, so it doesn't have a return value. I think you mean to ask what the expression evaluates to.