[Tutor] (no subject)
Christian Witts
cwitts at compuscan.co.za
Wed Sep 9 08:30:17 CEST 2009
Lucas Prado Melo wrote:
> On Tue, Sep 8, 2009 at 2:09 PM, shellcom3 at juno.com
> <mailto:shellcom3 at juno.com> <shellcom3 at juno.com
> <mailto:shellcom3 at juno.com>> wrote:
>
> I,m trying to get a phrase from a user and print it backwards
> using the for statement along with the range function, but all I
> get with range function is integers not alpha. example range(-1)
> does not work.
>
> What about range(0, -n, -1) ?
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
That would need to have a starting value of -1 and an end value of
-(len(phrase)+1). Of else you can start at length - 1, end at zero and
a step value of -1.
--
Kind Regards,
Christian Witts
More information about the Tutor
mailing list