On 12/15/2014 07:47 PM, Danny Yoo wrote:
Thank you but actually whatever number I get from either 1 to 28,
each number represent a property name such as "Reading Railroad",
"Judy Avenue", "Pacific Gas and Electric", etc., etc.

For example:

if x = 1 then print "Mediterranean Avenue"
if x = 2 then print "Baltic Avenue"

Ah, cool!  Ok, then yes, definitely a list.  There's a sequential-ness
here that we should take advantage of.

    PLACES = ["Is-there-a-place-when-x-is-zero?",
                   "Mediterranean Avenue",
                   "Baltic Avenue",
                   ]    # and so on ...

    print PLACES[x]


so that all the conditioning dissolves into a single list lookup.
There might need to be a few more checks to make sure x is in bounds,
but it's worth it here.
Thank you, thank you. As I think it over through the night, I had a
very faint idea of what you suggested. Again, thank.

Ken

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to