Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #79082
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-10-14 01:39 -0700 |
| References | <f267ac94-2bd4-4d46-a030-616b7d13e5e4@googlegroups.com> |
| Message-ID | <2abcabe0-c8b1-4386-b6e5-4fcfa48a3b5e@googlegroups.com> (permalink) |
| Subject | Re: Code Review for Paper, Rock, Scissors |
| From | Glenn Hutchings <zondo42@gmail.com> |
Hi there! Welcome to Python.
On Tuesday, 14 October 2014 09:04:51 UTC+1, Revenant wrote:
> I am new to Python and would also like to see if any of you programming
> gurus have some suggestions about how I can simplify code, and also if
> there are any other good starter programs to work on to improve my
> skills.
I'm sure you'll get a lot of helpful advice here. Here's a start: you have
a lot of places where you're comparing variables to the capitalized and
lower-case versions of the same string. You could halve that number if you
converted your input to lowercase first. For example:
if menuselection == 'play' or menuselection == 'Play':
changes to:
if menuselection.lower() == 'play':
There are plenty of other string methods you might find useful.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Code Review for Paper, Rock, Scissors Revenant <faceofoblivionofficial@gmail.com> - 2014-10-14 01:04 -0700 Re: Code Review for Paper, Rock, Scissors Glenn Hutchings <zondo42@gmail.com> - 2014-10-14 01:39 -0700 Re:Code Review for Paper, Rock, Scissors Dave Angel <davea@davea.name> - 2014-10-14 06:23 -0400 Re: Code Review for Paper, Rock, Scissors Chris Angelico <rosuav@gmail.com> - 2014-10-15 00:35 +1100 Re: Code Review for Paper, Rock, Scissors Larry Hudson <orgnut@yahoo.com> - 2014-10-15 00:56 -0700
csiph-web