On 21/01/2014 10:24, Mkhanyisi Madlavana wrote:
How would I print washington and monroe using [:]?
print X[::3]
How would I print every element but those two names?
print X[1::2]
On 21 January 2014 12:18, Alan Gauld mailto:alan.ga...@btinternet.com>> wrote:
On 21/01/14 06:18, Adriansanch
How would I print washington and monroe using [:]?
print X[::3]
How would I print every element but those two names?
print X[1::2]
On 21 January 2014 12:18, Alan Gauld wrote:
> On 21/01/14 06:18, Adriansanchez wrote:
>
>> Hello everyone,
>> I am newbie to Python and programming in general. My
If you are playing around at the Python prompt (the >>>), which you
really should be to get the hang of this stuff, you might notice that
the bracket indexing that you and everyone is talking about works both
on strings (Y) and on lists (X: in this case, a list of strings). They
may not behave the
On Tue, Jan 21, 2014 at 5:18 AM, Alan Gauld wrote:
>
> for name in X:
> if name not in (X[0], X[-1]):
>print name
>
> For the special case of excluding the first and
> last names you could use the [:] notation like
> this:
>
> print X[1:-1]
>
> But that only works where you want *all*
On 01/21/2014 07:18 AM, Adriansanchez wrote:
Hello everyone,
I am newbie to Python and programming in general. My question is, given a list:
X=['washington','adams','jefferson','madison','monroe']
And a string:
Y='washington,adams,jefferson,madison,monroe'
Side note: you can generate X automati
On 21/01/14 06:18, Adriansanchez wrote:
Hello everyone,
I am newbie to Python and programming in general. My question is, given a list:
X=['washington','adams','jefferson','madison','monroe']
And a string:
Y='washington,adams,jefferson,madison,monroe'
How would I print washington and monroe usin
Hello everyone,
I am newbie to Python and programming in general. My question is, given a list:
X=['washington','adams','jefferson','madison','monroe']
And a string:
Y='washington,adams,jefferson,madison,monroe'
How would I print washington and monroe using [:]?
How would I print every element b