>
> 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.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to