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


Groups > comp.lang.python > #79469 > unrolled thread

I am out of trial and error again Lists

Started bySeymore4Head <Seymore4Head@Hotmail.invalid>
First post2014-10-22 16:30 -0400
Last post2014-10-25 22:15 +0000
Articles 20 on this page of 157 — 23 participants

Back to article view | Back to comp.lang.python


Contents

  I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 16:30 -0400
    Re: I am out of trial and error again Lists Joel Goldstick <joel.goldstick@gmail.com> - 2014-10-22 16:57 -0400
      Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 17:04 -0400
        Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-22 14:35 -0700
          Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 17:38 -0400
    Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-22 22:28 +0100
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 18:30 -0400
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 18:32 -0400
      Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-22 23:55 +0100
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 19:26 -0400
          Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 00:44 +0100
            Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 20:02 -0400
              Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 02:29 +0100
              Re: I am out of trial and error again  Lists alex23 <wuwei23@gmail.com> - 2014-10-23 11:37 +1000
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:52 -0400
              Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-22 19:58 -0700
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 23:05 -0400
                Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-22 20:16 -0700
                Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-23 02:31 -0400
      Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 00:09 +0100
      Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-23 00:10 -0700
        Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-23 09:23 -0400
          Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:00 -0400
            Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-23 20:23 -0400
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 09:53 -0400
      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 09:15 +0000
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:04 -0400
          Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 15:55 +0000
            Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 13:01 -0400
              Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 13:07 -0400
                Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 13:39 -0600
                  Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 16:15 -0400
                  Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 16:44 -0400
                    Re: I am out of trial and error again Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 22:03 +0100
                    Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-23 19:13 -0700
                Re: I am out of trial and error again Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-23 23:14 -0400
                Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-24 14:32 +1100
              Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 21:56 -0700
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:38 -0400
                  Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 01:51 +1100
                    Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 11:04 -0400
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 02:13 +1100
                  Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 08:56 -0700
                    Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 10:35 -0600
                      Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:10 -0700
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 12:37 -0400
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 03:47 +1100
                        Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 09:56 -0700
                        Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:03 -0400
                          Re: I am out of trial and error again Lists "Albert Visser" <albert.visser@gmail.com> - 2014-10-24 19:18 +0200
                            Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:23 -0400
                              Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:42 -0700
                                Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:42 -0400
                          Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 11:52 -0600
                            Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 14:15 -0400
                              Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 14:20 -0400
                                Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 19:40 +0100
                                  Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:07 -0400
                                    Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:49 +0000
                                    Re: I am out of trial and error again Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 23:46 -0700
                                      Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-25 08:17 -0600
                                    Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:47 -0400
                              Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 11:57 -0700
                                Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:09 -0400
                                  Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 12:25 -0700
                                    Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 15:33 -0400
                                      Re: I am out of trial and error again Lists sohcahtoa82@gmail.com - 2014-10-24 12:55 -0700
                                        Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 16:00 -0400
                              Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:19 +0000
                                Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 17:35 -0400
                                  Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:23 +0000
                              Re: I am out of trial and error again Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:37 -0400
                          Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 19:33 +0100
                      Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 09:54 -0700
                        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 13:04 -0400
                          Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 10:17 -0700
                          Re: I am out of trial and error again  Lists Dave Angel <davea@davea.name> - 2014-10-24 18:09 -0400
                            Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:27 -0400
                              Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 16:01 -0700
                              Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-24 20:27 -0400
                                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:42 -0400
                      Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 11:05 -0600
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 04:10 +1100
                      Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 23:04 -0700
                  Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 20:37 +0000
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 16:58 -0400
                      Re: I am out of trial and error again  Lists alister <alister.nospam.ware@ntlworld.com> - 2014-10-24 21:07 +0000
                      Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-24 15:11 -0600
                      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:21 +0000
                        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:48 -0400
                  Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 21:48 +0000
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:14 -0400
                    Re: I am out of trial and error again  Lists Grant Edwards <invalid@invalid.invalid> - 2014-10-25 15:01 +0000
                      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-25 20:51 +0000
                  Re: I am out of trial and error again  Lists Larry Hudson <orgnut@yahoo.com> - 2014-10-24 19:16 -0700
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 22:41 -0400
                      Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-25 08:25 +0100
                      Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 15:10 -0400
                  Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-25 14:23 -0400
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-25 14:42 -0400
                  Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-25 18:48 -0400
                  Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-26 00:25 +0100
                  Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-26 01:08 -0400
                  Re: I am out of trial and error again  Lists Terry Reedy <tjreedy@udel.edu> - 2014-10-26 17:44 -0400
                  Re: I am out of trial and error again  Lists Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-26 20:57 -0400
    Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-22 22:43 +0000
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 19:11 -0400
        The “trials” in “trial and error” should be as simple as possible (was: I am out of trial and error again  Lists) Ben Finney <ben+python@benfinney.id.au> - 2014-10-23 10:59 +1100
        Re: I am out of trial and error again  Lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-23 11:05 +1100
          Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 20:10 -0400
            Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-23 02:31 +0100
              Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:35 -0400
                Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-22 21:57 -0400
                  Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 08:20 +0100
                    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:01 -0400
                  Re: I am out of trial and error again Lists Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-23 01:56 -0600
                  Re: I am out of trial and error again Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-23 09:09 +0100
                    Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 06:42 -0700
                      Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:03 -0400
                        Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-23 08:35 -0700
                      Re: I am out of trial and error again Lists giacomo boffi <pecore@pascolo.net> - 2014-10-23 16:25 +0200
                        Re: I am out of trial and error again Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:29 -0400
                        Re: I am out of trial and error again Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 16:00 +0000
                Re: I am out of trial and error again  Lists giacomo boffi <pecore@pascolo.net> - 2014-10-23 16:40 +0200
                  Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-23 10:46 -0400
                  Re: I am out of trial and error again  Lists giacomo boffi <pecore@pascolo.net> - 2014-10-24 17:56 +0200
        Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-23 09:21 +0000
    Re: I am out of trial and error again  Lists Tobiah <toby@tobiah.org> - 2014-10-23 07:51 -0700
    Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 08:05 +0100
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:47 -0400
        Re: I am out of trial and error again  Lists mm0fmf <none@mailinator.com> - 2014-10-24 22:06 +0100
    Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-24 09:12 +0100
      Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 10:48 -0400
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:26 -0400
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 18:58 -0400
      Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 16:27 -0700
        Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:48 -0400
          Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 19:57 -0400
            Re: I am out of trial and error again  Lists MRAB <python@mrabarnett.plus.com> - 2014-10-25 01:20 +0100
              Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:37 -0400
                Re: I am out of trial and error again  Lists Cameron Simpson <cs@zip.com.au> - 2014-10-25 11:52 +1100
          Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 20:46 -0700
            Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 21:09 -0700
              Re: I am out of trial and error again  Lists Ben Finney <ben+python@benfinney.id.au> - 2014-10-25 15:25 +1100
                Re: I am out of trial and error again  Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 22:40 -0700
                  Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 16:49 +1100
                    Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-24 22:55 -0700
                      Re: I am out of trial and error again Lists Chris Angelico <rosuav@gmail.com> - 2014-10-25 17:03 +1100
                      Re: I am out of trial and error again Lists Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-25 18:44 +1100
                        Re: I am out of trial and error again Lists Rustom Mody <rustompmody@gmail.com> - 2014-10-25 10:24 -0700
                    Side-effects [was Re: I am out of trial and error again Lists] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-10-26 17:12 +1100
                      Re: Side-effects [was Re: I am out of trial and error again Lists] Chris Angelico <rosuav@gmail.com> - 2014-10-26 17:42 +1100
            Re: I am out of trial and error again  Lists giacomo boffi <pecore@pascolo.net> - 2014-10-27 22:26 +0100
      Re: I am out of trial and error again  Lists Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-10-25 00:27 +0100
      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-24 23:35 +0000
    Re: I am out of trial and error again  Lists Seymore4Head <Seymore4Head@Hotmail.invalid> - 2014-10-24 20:15 -0400
      Re: I am out of trial and error again  Lists Denis McMahon <denismfmcmahon@gmail.com> - 2014-10-25 22:15 +0000

Page 1 of 8  [1] 2 3 4 5 6 7 8  Next page →


#79469 — I am out of trial and error again Lists

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 16:30 -0400
SubjectI am out of trial and error again Lists
Message-ID<rr4g4ah01n2efganet7b8oml8uq1qaf9qc@4ax.com>
def nametonumber(name):
    lst=[""]
    for x,y in enumerate (name):
        lst=lst.append(y)
    print (lst)
    return (lst)
a=["1-800-getcharter"]
print (nametonumber(a))#18004382427837
    
  
The syntax for when to use a () and when to use [] still throws me a
curve.

For now, I am trying to end up with a list that has each character in
"a" as a single item.

I get:
None
None

[toc] | [next] | [standalone]


#79470 — Re: I am out of trial and error again Lists

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2014-10-22 16:57 -0400
SubjectRe: I am out of trial and error again Lists
Message-ID<mailman.15091.1414011422.18130.python-list@python.org>
In reply to#79469
On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head
<Seymore4Head@hotmail.invalid> wrote:
> def nametonumber(name):
>     lst=[""]
>     for x,y in enumerate (name):
>         lst=lst.append(y)
>     print (lst)
>     return (lst)
> a=["1-800-getcharter"]
> print (nametonumber(a))#18004382427837
>
>
> The syntax for when to use a () and when to use [] still throws me a
> curve.
() is tuples which are immutable which means that the items can't be
changed.  [] is list which means that each item can be changed.
Tuples are useful because they can be used as keys in dictionaries and
are guarantied not to change.  Lists are useful because they can be
updated.

What you are doing confuses me.  You don't use x, which is the enumerated value.

FIrst lst should be lst = [] .  You don't need to set the first
element in the list to an empty string.  You just want to establish
that you have an empty list called lst
Second, you don't need lst = lst.append(y) because you can just say
lst.append(y).  This will append the y value to the end of the list.
As to converting letters to the corresponding numbers on a phone
keypad, you don't show you code here for that
>
> For now, I am trying to end up with a list that has each character in
> "a" as a single item.
>
> I get:
> None
> None
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com

[toc] | [prev] | [next] | [standalone]


#79471 — Re: I am out of trial and error again Lists

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 17:04 -0400
SubjectRe: I am out of trial and error again Lists
Message-ID<hm6g4a51do0ll7v28ig7uvv36ehikhihvn@4ax.com>
In reply to#79470
On Wed, 22 Oct 2014 16:57:00 -0400, Joel Goldstick
<joel.goldstick@gmail.com> wrote:

>On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head
><Seymore4Head@hotmail.invalid> wrote:
>> def nametonumber(name):
>>     lst=[""]
>>     for x,y in enumerate (name):
>>         lst=lst.append(y)
>>     print (lst)
>>     return (lst)
>> a=["1-800-getcharter"]
>> print (nametonumber(a))#18004382427837
>>
>>
>> The syntax for when to use a () and when to use [] still throws me a
>> curve.
>() is tuples which are immutable which means that the items can't be
>changed.  [] is list which means that each item can be changed.
>Tuples are useful because they can be used as keys in dictionaries and
>are guarantied not to change.  Lists are useful because they can be
>updated.
>
>What you are doing confuses me.  You don't use x, which is the enumerated value.
>
>FIrst lst should be lst = [] .  You don't need to set the first
>element in the list to an empty string.  You just want to establish
>that you have an empty list called lst
>Second, you don't need lst = lst.append(y) because you can just say
>lst.append(y).  This will append the y value to the end of the list.
>As to converting letters to the corresponding numbers on a phone
>keypad, you don't show you code here for that
>>
>> For now, I am trying to end up with a list that has each character in
>> "a" as a single item.
>>
>> I get:
>> None
>> None
>> --
>> https://mail.python.org/mailman/listinfo/python-list

The lst=lst.append(y)
Was the mistake I never could see.

I am using enumerate just for practice.  To me that is just as easy as
typing len(something) and it seems more flexible.

and.......the reason I don't show the code for the conversions is that
I haven't got that far yet.  :)

Thank you

[toc] | [prev] | [next] | [standalone]


#79473 — Re: I am out of trial and error again Lists

Fromsohcahtoa82@gmail.com
Date2014-10-22 14:35 -0700
SubjectRe: I am out of trial and error again Lists
Message-ID<32d4b0d0-2293-4f2b-bbe3-04d76affd795@googlegroups.com>
In reply to#79471
On Wednesday, October 22, 2014 2:06:35 PM UTC-7, Seymore4Head wrote:
> On Wed, 22 Oct 2014 16:57:00 -0400, Joel Goldstick
> <joel.goldstick@gmail.com> wrote:
> 
> >On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head
> ><Seymore4Head@hotmail.invalid> wrote:
> >> def nametonumber(name):
> >>     lst=[""]
> >>     for x,y in enumerate (name):
> >>         lst=lst.append(y)
> >>     print (lst)
> >>     return (lst)
> >> a=["1-800-getcharter"]
> >> print (nametonumber(a))#18004382427837
> >>
> >>
> >> The syntax for when to use a () and when to use [] still throws me a
> >> curve.
> >() is tuples which are immutable which means that the items can't be
> >changed.  [] is list which means that each item can be changed.
> >Tuples are useful because they can be used as keys in dictionaries and
> >are guarantied not to change.  Lists are useful because they can be
> >updated.
> >
> >What you are doing confuses me.  You don't use x, which is the enumerated value.
> >
> >FIrst lst should be lst = [] .  You don't need to set the first
> >element in the list to an empty string.  You just want to establish
> >that you have an empty list called lst
> >Second, you don't need lst = lst.append(y) because you can just say
> >lst.append(y).  This will append the y value to the end of the list.
> >As to converting letters to the corresponding numbers on a phone
> >keypad, you don't show you code here for that
> >>
> >> For now, I am trying to end up with a list that has each character in
> >> "a" as a single item.
> >>
> >> I get:
> >> None
> >> None
> >> --
> >> https://mail.python.org/mailman/listinfo/python-list
> 
> The lst=lst.append(y)
> Was the mistake I never could see.
> 
> I am using enumerate just for practice.  To me that is just as easy as
> typing len(something) and it seems more flexible.
> 
> and.......the reason I don't show the code for the conversions is that
> I haven't got that far yet.  :)
> 
> Thank you

I'm still confused as to why you're using enumerate.  Using it when you don't need to for "practice" just seems strange.  You don't even need to use len(something) in your case.  You should just be using 'for y in name:' if you don't need that x.  Enumerate is essentially just a shortcut to zipping a range based on the length.  For example...

for x, y in enumerate(name):

is equivalent to:

for x, y in zip(range(len(name)), name):

And both are pointless if you're not using the x.

Also, is there a reason why you're defining 'a' to be a list with a single string value, rather than just defining it as a string?  It seems like you should probably just have:

a = "1-800-getcharter"

[toc] | [prev] | [next] | [standalone]


#79474 — Re: I am out of trial and error again Lists

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 17:38 -0400
SubjectRe: I am out of trial and error again Lists
Message-ID<rp8g4ad3ouftpuj8uud5qe10notnv6vl2k@4ax.com>
In reply to#79473
On Wed, 22 Oct 2014 14:35:18 -0700 (PDT), sohcahtoa82@gmail.com wrote:

>On Wednesday, October 22, 2014 2:06:35 PM UTC-7, Seymore4Head wrote:
>> On Wed, 22 Oct 2014 16:57:00 -0400, Joel Goldstick
>> <joel.goldstick@gmail.com> wrote:
>> 
>> >On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head
>> ><Seymore4Head@hotmail.invalid> wrote:
>> >> def nametonumber(name):
>> >>     lst=[""]
>> >>     for x,y in enumerate (name):
>> >>         lst=lst.append(y)
>> >>     print (lst)
>> >>     return (lst)
>> >> a=["1-800-getcharter"]
>> >> print (nametonumber(a))#18004382427837
>> >>
>> >>
>> >> The syntax for when to use a () and when to use [] still throws me a
>> >> curve.
>> >() is tuples which are immutable which means that the items can't be
>> >changed.  [] is list which means that each item can be changed.
>> >Tuples are useful because they can be used as keys in dictionaries and
>> >are guarantied not to change.  Lists are useful because they can be
>> >updated.
>> >
>> >What you are doing confuses me.  You don't use x, which is the enumerated value.
>> >
>> >FIrst lst should be lst = [] .  You don't need to set the first
>> >element in the list to an empty string.  You just want to establish
>> >that you have an empty list called lst
>> >Second, you don't need lst = lst.append(y) because you can just say
>> >lst.append(y).  This will append the y value to the end of the list.
>> >As to converting letters to the corresponding numbers on a phone
>> >keypad, you don't show you code here for that
>> >>
>> >> For now, I am trying to end up with a list that has each character in
>> >> "a" as a single item.
>> >>
>> >> I get:
>> >> None
>> >> None
>> >> --
>> >> https://mail.python.org/mailman/listinfo/python-list
>> 
>> The lst=lst.append(y)
>> Was the mistake I never could see.
>> 
>> I am using enumerate just for practice.  To me that is just as easy as
>> typing len(something) and it seems more flexible.
>> 
>> and.......the reason I don't show the code for the conversions is that
>> I haven't got that far yet.  :)
>> 
>> Thank you
>
>I'm still confused as to why you're using enumerate.  Using it when you don't need to for "practice" just seems strange.  You don't even need to use len(something) in your case.  You should just be using 'for y in name:' if you don't need that x.  Enumerate is essentially just a shortcut to zipping a range based on the length.  For example...
>
>for x, y in enumerate(name):
>
>is equivalent to:
>
>for x, y in zip(range(len(name)), name):
>
>And both are pointless if you're not using the x.
>
>Also, is there a reason why you're defining 'a' to be a list with a single string value, rather than just defining it as a string?  It seems like you should probably just have:
>
>a = "1-800-getcharter"


The lst=lst part was throwing an error I didn't understand.  That was
the only reason I added brackets around the 'a'.  I was getting in to
trial and error stuff.   Mostly error.

[toc] | [prev] | [next] | [standalone]


#79472 — Re: I am out of trial and error again Lists

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-10-22 22:28 +0100
SubjectRe: I am out of trial and error again Lists
Message-ID<mailman.15092.1414013297.18130.python-list@python.org>
In reply to#79469
On 22/10/2014 21:57, Joel Goldstick wrote:
> On Wed, Oct 22, 2014 at 4:30 PM, Seymore4Head
> <Seymore4Head@hotmail.invalid> wrote:
>> def nametonumber(name):
>>      lst=[""]
>>      for x,y in enumerate (name):
>>          lst=lst.append(y)
>>      print (lst)
>>      return (lst)
>> a=["1-800-getcharter"]
>> print (nametonumber(a))#18004382427837
>>
>>
>> The syntax for when to use a () and when to use [] still throws me a
>> curve.
> () is tuples which are immutable which means that the items can't be
> changed.  [] is list which means that each item can be changed.
> Tuples are useful because they can be used as keys in dictionaries and
> are guarantied not to change.  Lists are useful because they can be
> updated.
>

This is wrong, commas define tuples.

type mytest.py
a = 1, 2
print(type(a))

c:\Users\Mark\MyPython>mytest.py
<class 'tuple'>


-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#79475

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 18:30 -0400
Message-ID<jpag4a9sq9ljrn3ut8jm7l0b7tqeol2ngm@4ax.com>
In reply to#79469
On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
<Seymore4Head@Hotmail.invalid> wrote:

One more question.
if y in str(range(10)
Why doesn't that work.
I commented it out and just did it "long hand"

def nametonumber(name):
    lst=[]
    nx=[]
    for x in (name):
        lst.append(x)
    for y in (lst):
        #if y in str(range(10)):
        if y in "1234567890":
            nx.append(y)        
        if y in " -()":
            nx.append(y)
        if y in "abc":
            nx.append("2")
        if y in "def":
            nx.append("3")
        if y in "ghi":
            nx.append("4")
        if y in "jkl":
            nx.append("5")
        if y in "mno":
            nx.append("6")
        if y in "pqrs":
            nx.append("7")
        if y in "tuv":
            nx.append("8")
        if y in "wxyz":
            nx.append("9")
    number="".join(str(e) for e in nx)
    return (number)
a="1-800-getcharter"
print (nametonumber(a))#1800 438 2427 837
a="1-800-leo laporte"
print (nametonumber(a))
a="1 800 callaprogrammer"
print (nametonumber(a))

[toc] | [prev] | [next] | [standalone]


#79476

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 18:32 -0400
Message-ID<d2cg4a15rit57shl0qp72o8dbtiuonbh6n@4ax.com>
In reply to#79475
BTW I know I didn't check for Caps yet.

On Wed, 22 Oct 2014 18:30:17 -0400, Seymore4Head
<Seymore4Head@Hotmail.invalid> wrote:

>On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
><Seymore4Head@Hotmail.invalid> wrote:
>
>One more question.
>if y in str(range(10)
>Why doesn't that work.
>I commented it out and just did it "long hand"
>
>def nametonumber(name):
>    lst=[]
>    nx=[]
>    for x in (name):
>        lst.append(x)
>    for y in (lst):
>        #if y in str(range(10)):
>        if y in "1234567890":
>            nx.append(y)        
>        if y in " -()":
>            nx.append(y)
>        if y in "abc":
>            nx.append("2")
>        if y in "def":
>            nx.append("3")
>        if y in "ghi":
>            nx.append("4")
>        if y in "jkl":
>            nx.append("5")
>        if y in "mno":
>            nx.append("6")
>        if y in "pqrs":
>            nx.append("7")
>        if y in "tuv":
>            nx.append("8")
>        if y in "wxyz":
>            nx.append("9")
>    number="".join(str(e) for e in nx)
>    return (number)
>a="1-800-getcharter"
>print (nametonumber(a))#1800 438 2427 837
>a="1-800-leo laporte"
>print (nametonumber(a))
>a="1 800 callaprogrammer"
>print (nametonumber(a))

[toc] | [prev] | [next] | [standalone]


#79478

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-10-22 23:55 +0100
Message-ID<mailman.15093.1414018582.18130.python-list@python.org>
In reply to#79475
On 22/10/2014 23:30, Seymore4Head wrote:
> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:
>
> One more question.
> if y in str(range(10)
> Why doesn't that work.

Invalid syntax, it should obviously be:-

if y in str(range(10)):

OTOH if you've simply mistyped above what did you expect to happen and 
what actually happened?  Give us the actual code that you ran and the 
full traceback.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#79482

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 19:26 -0400
Message-ID<mseg4a92vr3r4kimt354gce80vanl4t601@4ax.com>
In reply to#79478
On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence
<breamoreboy@yahoo.co.uk> wrote:

>On 22/10/2014 23:30, Seymore4Head wrote:
>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
>> <Seymore4Head@Hotmail.invalid> wrote:
>>
>> One more question.
>> if y in str(range(10)
>> Why doesn't that work.
>
>Invalid syntax, it should obviously be:-
>
>if y in str(range(10)):
>
>OTOH if you've simply mistyped above what did you expect to happen and 
>what actually happened?  Give us the actual code that you ran and the 
>full traceback.

I don't get an error.  It just doesn't print the numbers correctly.
http://imgur.com/a/2loQV
You can click on the images and make them larger.
Thanks

[toc] | [prev] | [next] | [standalone]


#79483

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2014-10-23 00:44 +0100
Message-ID<mailman.15096.1414021456.18130.python-list@python.org>
In reply to#79482
On 23/10/2014 00:26, Seymore4Head wrote:
> On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence
> <breamoreboy@yahoo.co.uk> wrote:
>
>> On 22/10/2014 23:30, Seymore4Head wrote:
>>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
>>> <Seymore4Head@Hotmail.invalid> wrote:
>>>
>>> One more question.
>>> if y in str(range(10)
>>> Why doesn't that work.
>>
>> Invalid syntax, it should obviously be:-
>>
>> if y in str(range(10)):
>>
>> OTOH if you've simply mistyped above what did you expect to happen and
>> what actually happened?  Give us the actual code that you ran and the
>> full traceback.
>
> I don't get an error.  It just doesn't print the numbers correctly.
> http://imgur.com/a/2loQV
> You can click on the images and make them larger.
> Thanks
>

I suggest you try str(range(10)) from the interactive prompt and see 
exactly what you get, as it's nothing like what you expect :)

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#79486

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 20:02 -0400
Message-ID<pbhg4adb5oca390bvk304p4am2sheg74ts@4ax.com>
In reply to#79483
On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence
<breamoreboy@yahoo.co.uk> wrote:

>On 23/10/2014 00:26, Seymore4Head wrote:
>> On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence
>> <breamoreboy@yahoo.co.uk> wrote:
>>
>>> On 22/10/2014 23:30, Seymore4Head wrote:
>>>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
>>>> <Seymore4Head@Hotmail.invalid> wrote:
>>>>
>>>> One more question.
>>>> if y in str(range(10)
>>>> Why doesn't that work.
>>>
>>> Invalid syntax, it should obviously be:-
>>>
>>> if y in str(range(10)):
>>>
>>> OTOH if you've simply mistyped above what did you expect to happen and
>>> what actually happened?  Give us the actual code that you ran and the
>>> full traceback.
>>
>> I don't get an error.  It just doesn't print the numbers correctly.
>> http://imgur.com/a/2loQV
>> You can click on the images and make them larger.
>> Thanks
>>
>
>I suggest you try str(range(10)) from the interactive prompt and see 
>exactly what you get, as it's nothing like what you expect :)

I see that now.  So there may not be a short hand solution.

Thanks

[toc] | [prev] | [next] | [standalone]


#79491

FromMRAB <python@mrabarnett.plus.com>
Date2014-10-23 02:29 +0100
Message-ID<mailman.15099.1414027786.18130.python-list@python.org>
In reply to#79486
On 2014-10-23 01:02, Seymore4Head wrote:
> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence
> <breamoreboy@yahoo.co.uk> wrote:
>
>>On 23/10/2014 00:26, Seymore4Head wrote:
>>> On Wed, 22 Oct 2014 23:55:57 +0100, Mark Lawrence
>>> <breamoreboy@yahoo.co.uk> wrote:
>>>
>>>> On 22/10/2014 23:30, Seymore4Head wrote:
>>>>> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
>>>>> <Seymore4Head@Hotmail.invalid> wrote:
>>>>>
>>>>> One more question.
>>>>> if y in str(range(10)
>>>>> Why doesn't that work.
>>>>
>>>> Invalid syntax, it should obviously be:-
>>>>
>>>> if y in str(range(10)):
>>>>
>>>> OTOH if you've simply mistyped above what did you expect to happen and
>>>> what actually happened?  Give us the actual code that you ran and the
>>>> full traceback.
>>>
>>> I don't get an error.  It just doesn't print the numbers correctly.
>>> http://imgur.com/a/2loQV
>>> You can click on the images and make them larger.
>>> Thanks
>>>
>>
>>I suggest you try str(range(10)) from the interactive prompt and see
>>exactly what you get, as it's nothing like what you expect :)
>
> I see that now.  So there may not be a short hand solution.
>
range(10) will yield the integers 0-9.

You can iterate over them, turning each into a string, and then join
them together:

''.join(str(n) for n in range(10))

[toc] | [prev] | [next] | [standalone]


#79493

Fromalex23 <wuwei23@gmail.com>
Date2014-10-23 11:37 +1000
Message-ID<m29m4l$793$1@dont-email.me>
In reply to#79486
On 23/10/2014 10:02 AM, Seymore4Head wrote:
> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence
> <breamoreboy@yahoo.co.uk> wrote:
>>>>> One more question.
>>>>> if y in str(range(10)
>>>>> Why doesn't that work.
>> I suggest you try str(range(10)) from the interactive prompt and see
>> exactly what you get, as it's nothing like what you expect :)
>
> I see that now.  So there may not be a short hand solution.

There are two 'short hand solutions' to do what you want here:

     import string

     if y in string.digits:
         ....

Or even simpler:

     if y.isdigit():
         ...

[toc] | [prev] | [next] | [standalone]


#79495

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 21:52 -0400
Message-ID<7rng4a9pcq6u9oke37gsi0lvsttbtd0mkc@4ax.com>
In reply to#79493
On Thu, 23 Oct 2014 11:37:27 +1000, alex23 <wuwei23@gmail.com> wrote:

>On 23/10/2014 10:02 AM, Seymore4Head wrote:
>> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence
>> <breamoreboy@yahoo.co.uk> wrote:
>>>>>> One more question.
>>>>>> if y in str(range(10)
>>>>>> Why doesn't that work.
>>> I suggest you try str(range(10)) from the interactive prompt and see
>>> exactly what you get, as it's nothing like what you expect :)
>>
>> I see that now.  So there may not be a short hand solution.
>
>There are two 'short hand solutions' to do what you want here:
>
>     import string
>
>     if y in string.digits:
>         ....
>
>Or even simpler:
>
>     if y.isdigit():
>         ...
Thanks

[toc] | [prev] | [next] | [standalone]


#79497

FromLarry Hudson <orgnut@yahoo.com>
Date2014-10-22 19:58 -0700
Message-ID<IaKdnS5uxtVN89XJnZ2dnUU7-dmdnZ2d@giganews.com>
In reply to#79486
On 10/22/2014 05:02 PM, Seymore4Head wrote:
> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence
> <breamoreboy@yahoo.co.uk> wrote:

<snip>  (This is in reference to the line:  if y in str(range(10)):)

>> I suggest you try str(range(10)) from the interactive prompt and see
>> exactly what you get, as it's nothing like what you expect :)
>
> I see that now.  So there may not be a short hand solution.
>

Yes there is.

That statement would work in Py2 as-is, but in Py3 it needs to be changed to:

if y in list(range(10)):

This give you a list not a string, but that's actually what you want here.  If you _really_ want 
a string, use join():  "".join(list(range(10)))

------  Also, from another post:  -------

 > Thanks a lot for all your suggestions.  I haven't learned to use the
 > interpreter yet.  I do plan on learning to use it.

You are making yourself work several hundred times harder if you don't learn to use the 
interactive mode!

 > The problem with that at the moment is that I have enrolled in an
 > online computer class.  They use Codeskulptor.
 > Codeskulptor code is not compatible to standard Python.

I would be GREATLY bothered by the fact that it is not standard Python -- it sounds like a poor 
course.  You also seems to imply that you are only using those on-line tools and don't have a 
real Python installed on your own system.  If so, that is an extremely bad choice.  And if so, 
stop everything until you do install it NOW (definitely Python 3).  Then you can play with 
things on your own system IN THE INTERACTIVE MODE!!!  That's when you will start actually learning.

      -=- Larry -=-

[toc] | [prev] | [next] | [standalone]


#79498

FromSeymore4Head <Seymore4Head@Hotmail.invalid>
Date2014-10-22 23:05 -0400
Message-ID<q1sg4al8onecm49b4f4ap46cgdt064gi8v@4ax.com>
In reply to#79497
On Wed, 22 Oct 2014 19:58:24 -0700, Larry Hudson <orgnut@yahoo.com>
wrote:

>On 10/22/2014 05:02 PM, Seymore4Head wrote:
>> On Thu, 23 Oct 2014 00:44:01 +0100, Mark Lawrence
>> <breamoreboy@yahoo.co.uk> wrote:
>
><snip>  (This is in reference to the line:  if y in str(range(10)):)
>
>>> I suggest you try str(range(10)) from the interactive prompt and see
>>> exactly what you get, as it's nothing like what you expect :)
>>
>> I see that now.  So there may not be a short hand solution.
>>
>
>Yes there is.
>
>That statement would work in Py2 as-is, but in Py3 it needs to be changed to:
>
>if y in list(range(10)):
>
>This give you a list not a string, but that's actually what you want here.  If you _really_ want 
>a string, use join():  "".join(list(range(10)))
>
>------  Also, from another post:  -------
>
> > Thanks a lot for all your suggestions.  I haven't learned to use the
> > interpreter yet.  I do plan on learning to use it.
>
>You are making yourself work several hundred times harder if you don't learn to use the 
>interactive mode!
>
> > The problem with that at the moment is that I have enrolled in an
> > online computer class.  They use Codeskulptor.
> > Codeskulptor code is not compatible to standard Python.
>
>I would be GREATLY bothered by the fact that it is not standard Python -- it sounds like a poor 
>course.  You also seems to imply that you are only using those on-line tools and don't have a 
>real Python installed on your own system.  If so, that is an extremely bad choice.  And if so, 
>stop everything until you do install it NOW (definitely Python 3).  Then you can play with 
>things on your own system IN THE INTERACTIVE MODE!!!  That's when you will start actually learning.
>
>      -=- Larry -=-

OK  Good advice.  I already have Py3 installed.  Interactive mode is
the next item on my do list.

Thanks

[toc] | [prev] | [next] | [standalone]


#79499

FromRustom Mody <rustompmody@gmail.com>
Date2014-10-22 20:16 -0700
Message-ID<e0c84494-3b5a-45df-bf66-c15a7c3c4fa3@googlegroups.com>
In reply to#79497
On Thursday, October 23, 2014 8:28:39 AM UTC+5:30, Larry Hudson wrote:

> ------  Also, from another post:  -------
>  > Thanks a lot for all your suggestions.  I haven't learned to use the
>  > interpreter yet.  I do plan on learning to use it.
> You are making yourself work several hundred times harder if you don't learn to use the 
> interactive mode!

+100

That a noob takes the longest path out of noob-land --- well thats the 
fun of life!

That experienced people are not peremptory enough
-- yeah "My way or Highway" is rude but necessary at times -- is unfortunate.

[toc] | [prev] | [next] | [standalone]


#79502

FromTerry Reedy <tjreedy@udel.edu>
Date2014-10-23 02:31 -0400
Message-ID<mailman.15102.1414045891.18130.python-list@python.org>
In reply to#79497
On 10/22/2014 10:58 PM, Larry Hudson wrote:

> This give you a list not a string, but that's actually what you want
> here.  If you _really_ want a string, use join():  "".join(list(range(10)))

Interactive mode makes it really easy to test before posting.

 >>> "".join(list(range(10)))

Traceback (most recent call last):
   File "<pyshell#0>", line 1, in <module>
     "".join(list(range(10)))
TypeError: sequence item 0: expected string, int found

 >>> "".join(str(i) for i in range(10))
'0123456789'

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#79479

FromMRAB <python@mrabarnett.plus.com>
Date2014-10-23 00:09 +0100
Message-ID<mailman.15094.1414019406.18130.python-list@python.org>
In reply to#79475
On 2014-10-22 23:30, Seymore4Head wrote:
> On Wed, 22 Oct 2014 16:30:37 -0400, Seymore4Head
> <Seymore4Head@Hotmail.invalid> wrote:
>
> One more question.
> if y in str(range(10)
> Why doesn't that work.

In what way doesn't it work?

If you want to know what it returns, print it out.

> I commented it out and just did it "long hand"
>
> def nametonumber(name):
>      lst=[]
>      nx=[]
>      for x in (name):

You don't need to put the parens around name...

>          lst.append(x)
>      for y in (lst):

...or around lst.

You're iterating over a string, putting its characters into a list, and
then iterating over that list. You're doing more work than you need to!

>          #if y in str(range(10)):
>          if y in "1234567890":
>              nx.append(y)
>          if y in " -()":
>              nx.append(y)
>          if y in "abc":
>              nx.append("2")
>          if y in "def":
>              nx.append("3")
>          if y in "ghi":
>              nx.append("4")
>          if y in "jkl":
>              nx.append("5")
>          if y in "mno":
>              nx.append("6")
>          if y in "pqrs":
>              nx.append("7")
>          if y in "tuv":
>              nx.append("8")
>          if y in "wxyz":
>              nx.append("9")
>      number="".join(str(e) for e in nx)

The list nx already contains strings, so you don't need str here.

>      return (number)

You don't need the parens here either.

> a="1-800-getcharter"
> print (nametonumber(a))#1800 438 2427 837
> a="1-800-leo laporte"
> print (nametonumber(a))
> a="1 800 callaprogrammer"
> print (nametonumber(a))
>

[toc] | [prev] | [next] | [standalone]


Page 1 of 8  [1] 2 3 4 5 6 7 8  Next page →

Back to top | Article view | comp.lang.python


csiph-web