On 12/15/2014 04:45 PM, Danny Yoo wrote:
As a side note: if we were to talk about how we'd do this in a
professional context, I think we'd recommend a library such as
"humanize", which has functions to go from numbers to human-friendly
string descriptions.
https://pypi.python.org/pypi/humanize
Whoops: wrong library. Humanize is a good one, but not exactly the
one I was supposed to cite. I should have cited num2words, which is a
cardinal number library:
https://pypi.python.org/pypi/num2words
.
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"
...
...
if x = 28 then print "Boardwalk"
Yes, I am using the property names from the game, Monopoly. I am
using them in conjunction with of playing a lottery game and using
Python to determine if I won anything from the numbers drawn and
being compared with what numbers I purchased.
Of course, the proper format in Python would be:
if x == "01":
print "Mediterranean Avenue"
...
...
if x == 28:
print "Boardwalk"
Again, thanks for your input.
Ken
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor