Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97045
| From | alister <alister.nospam.ware@ntlworld.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: A little test for you Guys😜 |
| Date | 2015-09-23 18:06 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <mtupmr$t32$1@speranza.aioe.org> (permalink) |
| References | <78fc66f6-04f9-4b84-8410-2e74fb75fbb4@googlegroups.com> <mtsoeh$cut$1@ger.gmane.org> <mailman.85.1442966183.28679.python-list@python.org> |
On Wed, 23 Sep 2015 00:56:19 +0100, MRAB wrote:
> On 2015-09-23 00:32, Mark Lawrence wrote:
>> On 22/09/2015 19:43, Python_Teacher via Python-list wrote:
>>> you have 10 minutes😂 Good luck!!
>>>
>>>
>>> 1. What is PEP8 ?
>>
>> It's the one between PEP7 and PEP9.
>>
>>
>>> 2. What are the different ways to distribute some python source code ?
>>
>> Write on sheet of paper, fold into paper dart, throw from window.
>>
>>
>>> 2 Lists
>>
>> Tut, tut, tut.
>>
>>
>>> Let's define the function plural :
>>>
>>> def plural(words):
>>> plurals = []
>>> 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?
>>
>> It is all ready optimised for programmer time so don't bother with it
>> unless there are unforeseen bugs.
>>
>>
>>> 3 Dictionaries
>>>
>>> Here are two dictionnaries :
>>>
>>> input = {
>>> 'foo1': 'bar1', 'chose': 'truc', 'foo2': 'bar2',
>>> }
>>> output = {
>>> 'bar1': 'foo1', 'truc': 'chose', 'bar2': 'foo2'
>>> }
>>>
>>> Question : Propose a function that returns output when you provide
>>> input ?
>>
>> def function():
>> return input("Who cares?")
>>
> You have a couple of problems:
>
> 1. 'input' is already bound to a dict.
>
> 2. From question 2, it's clear that Python 2 is being used, so you
> should be using 'raw_input' instead.
>
> [snip]
the question also shadows a builtin :-)
--
This is for all ill-treated fellows
Unborn and unbegot,
For them to read when they're in trouble
And I am not.
-- A. E. Housman
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A little test for you Guys😜 Python_Teacher <ljfc2000@yahoo.com> - 2015-09-22 11:43 -0700
Re: A little test for you Guys😜 Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-22 13:14 -0600
Re: A little test for you Guys😜 "Sven R. Kunze" <srkunze@mail.de> - 2015-09-22 21:42 +0200
Re: A little test for you Guys😜 Akira Li <4kir4.1i@gmail.com> - 2015-09-22 22:48 +0300
Re: A little test for you Guys😜 James Harris <james.harris.1@gmail.com> - 2015-09-22 13:28 -0700
Re: A little test for you Guys😜 sohcahtoa82@gmail.com - 2015-09-22 14:18 -0700
Re: A little test for you Guys😜 "James Harris" <james.harris.1@gmail.com> - 2015-09-22 22:31 +0100
Re: A little test for you Guys😜 Ian Kelly <ian.g.kelly@gmail.com> - 2015-09-22 15:33 -0600
Re: A little test for you Guys😜 Lj Fc <ljfc2000@yahoo.com> - 2015-09-22 15:21 -0700
Re: A little test for you Guys😜 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-09-23 00:32 +0100
Re: A little test for you Guys😜 Chris Angelico <rosuav@gmail.com> - 2015-09-23 09:45 +1000
Re: A little test for you Guys😜 MRAB <python@mrabarnett.plus.com> - 2015-09-23 00:56 +0100
Re: A little test for you Guys😜 alister <alister.nospam.ware@ntlworld.com> - 2015-09-23 18:06 +0000
Re: A little test for you Guys😜 Christian Gollwitzer <auriocus@gmx.de> - 2015-09-23 08:26 +0200
csiph-web