Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #43673

Re: Newbie questions on Python

References <a6562e3b-29af-4953-bc8b-49fa634d1be7@googlegroups.com>
Date 2013-04-17 01:30 +1000
Subject Re: Newbie questions on Python
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.666.1366126206.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Wed, Apr 17, 2013 at 1:20 AM,  <idkfaidkfaidkfa@gmail.com> wrote:
> Hi all,
> i'm programming in python for the first time (usually i use C as programming language). I don't understand these results:
>
>>>> a=[1,2,3,4,5]
>>>> a[:-1]
> [1, 2, 3, 4]
>>>> a[::-1]
> [5, 4, 3, 2, 1]
>>>> a[2::-1]
> [3, 2, 1]
>
> what does a[2::-1] means?

That's taking a slice. This page has something to say on the subject:

http://docs.python.org/3.3/tutorial/introduction.html

By the way, regarding your email address: there are no cheat codes in
Python... either that, or Python *is* a cheat code. :)

ChrisA
[[ VERY HAPPY CODING ADDED ]]

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Newbie questions on Python idkfaidkfaidkfa@gmail.com - 2013-04-16 08:20 -0700
  Re: Newbie questions on Python Chris Angelico <rosuav@gmail.com> - 2013-04-17 01:30 +1000
    Re: Newbie questions on Python Walter Hurry <walterhurry@lavabit.com> - 2013-04-16 21:40 +0000
      Re: Newbie questions on Python Chris Angelico <rosuav@gmail.com> - 2013-04-17 07:53 +1000
  Re: Newbie questions on Python Matt Jones <matt.walker.jones@gmail.com> - 2013-04-16 10:33 -0500
  Re: Newbie questions on Python Neil Cerutti <neilc@norwich.edu> - 2013-04-16 15:41 +0000
    Re: Newbie questions on Python Lele Gaifax <lele@metapensiero.it> - 2013-04-16 18:06 +0200
      Re: Newbie questions on Python Neil Cerutti <neilc@norwich.edu> - 2013-04-16 17:16 +0000

csiph-web