I am sure there is a better way to refine the following lines.

Letting x equal a number from 1 to 28, go through 28 separate 'if'
statements to print a resulting value that equaled the value of x.

For example:

x = 8

if x = 1, print 'one'
if x = 2, print 'two'
...
...
if x = 8, print 'eight'
...
...
if x = 28, print 'twenty eight'

Would a single line using list or dictionary be shorter?

Thanks,

Ken



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

Reply via email to