Code Review for Paper, Rock, Scissors
Glenn Hutchings
zondo42 at gmail.com
Tue Oct 14 04:39:46 EDT 2014
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.
More information about the Python-list
mailing list