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


Groups > comp.lang.python > #46849

Re: Beginner question

From Anssi Saari <as@sci.fi>
Newsgroups comp.lang.python
Subject Re: Beginner question
Date 2013-06-04 10:45 +0300
Message-ID <vg3hahefhel.fsf@coffee.modeemi.fi> (permalink)
References <323f2f5b-1f50-4689-90b8-74c411e43971@googlegroups.com>

Show all headers | View raw


eschneider92@comcast.net writes:

> Is there a more efficient way of doing this? Any help is gratly appreciated.

Efficiency in a short program isn't a big thing. You have some pretty
weird things in there, there's no need make single element tuples out of
your strings and then putting those in a list. Just put the strings in a
tuple and go. Likewise there's really no point in having while loops
where you exit on the first round now is there? Just use an if.

BTW, did I get the logic correctly, the end result is random? If true
then the logic can be simplified greatly, you can just discard the user
input and print a random choice of your three result strings...

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


Thread

Beginner question eschneider92@comcast.net - 2013-06-03 20:39 -0700
  RE: Beginner question Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 09:46 +0300
    Re: Beginner question John Ladasky <john_ladasky@sbcglobal.net> - 2013-06-04 00:53 -0700
      RE: Beginner question Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 11:17 +0300
  Re: Beginner question Anssi Saari <as@sci.fi> - 2013-06-04 10:45 +0300
    Re: Beginner question John Ladasky <john_ladasky@sbcglobal.net> - 2013-06-04 00:57 -0700
      Re: Beginner question Chris Angelico <rosuav@gmail.com> - 2013-06-04 18:24 +1000
      Re: Beginner question Peter Otten <__peter__@web.de> - 2013-06-04 11:23 +0200
      RE: Beginner question Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 14:23 +0300
        Re: Beginner question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-04 12:35 +0000
          RE: Beginner question Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 15:51 +0300
            Re: Beginner question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-07 02:21 +0000
      RE: Beginner question Fábio Santos <fabiosantosart@gmail.com> - 2013-06-04 12:34 +0100
      RE: Beginner question Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 14:53 +0300
        Re: Beginner question Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-04 12:25 +0000
          RE: Beginner question Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-04 15:37 +0300
          RE: Beginner question Fábio Santos <fabiosantosart@gmail.com> - 2013-06-04 13:47 +0100
      RE: Beginner question Fábio Santos <fabiosantosart@gmail.com> - 2013-06-04 13:15 +0100
      Re: Beginner question Mitya Sirenef <msirenef@lightbird.net> - 2013-06-04 13:16 -0400
  Re: Beginner question Larry Hudson <orgnut@yahoo.com> - 2013-06-04 02:13 -0700
    Re: Beginner question Roy Smith <roy@panix.com> - 2013-06-04 09:16 -0400
  Re: Beginner question Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-04 20:43 +0100
  Re: Beginner question eschneider92@comcast.net - 2013-06-05 20:42 -0700

csiph-web